# [Proto-Scripty] Re: Effect.Morph query

`You have the PHP echoing out class=morphable instead of class="morphable"`
```
.. try changing that and it may work.

Alex Mcauley
http://www.thevacancymarket.com
----- Original Message -----
From: "Andrew Dodd" <a...@slicethepie.com>
Sent: Friday, July 31, 2009 4:04 PM
Subject: [Proto-Scripty] Re: Effect.Morph query

No need to apologise, you're already being far more helpful than I
ever thought possible, I'm even learning stuff :)

The request is working now but sadly the morph effect isn't. I've
posted all the relevant stuff below:

Including the initMorph function:

<script src="<?php echo DIR_JS;?>prototype.js" type="text/
javascript"></script>
javascript"></script>
<script src="<?php echo DIR_JS;?>slider.js" type="text/javascript"></
script>
<script src="<?php echo DIR_JS;?>effects.js" type="text/JavaScript"></
script>
<script src="<?php echo DIR_JS;?>swfobject.js" type="text/
JavaScript"></script>
<script src="<?php echo DIR_JS;?>morphable.js" type="text/
JavaScript"></script> //this one
<script src="<?php echo DIR_JS;?>ajaxFunction.js" type="text/
JavaScript"></script>

morphable.js:

http://pastie.org/566774

The bit of the php file that responds to the ajax request:

http://pastie.org/566781

And finally, the html output from that query:

http://pastie.org/566782

Cheers
Andy

On Jul 31, 3:08 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:
> Sorry ANdy
>
> Adjust the code form "params : {....}"
>
> to
>
> "parameters"
>
> Typo -> My mistake.
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> ----- Original Message -----
> From: "Andrew Dodd" <a...@slicethepie.com>
> To: "Prototype & script.aculo.us"
> Sent: Friday, July 31, 2009 2:41 PM
> Subject: [Proto-Scripty] Re: Effect.Morph query
>
> The values are taken from a few diferrent places but Melody, Rating,
> Production and Commerciality are taken from Scriptaculous sliders (so
> just a hidden input value)
>
> The code from the page is:
>
> <input type='hidden' id='Melody' value=\"" . \$MELODY_VAL . "\"/>
> <input type='hidden' id='Rating' value=\"" . \$RATING_VAL . "\"/>
> <input type='hidden' id='Production' value=\"" . \$PRODUCTION_VAL . "\"/
>
> <input type='hidden' id='Commerciality' value=\"" .
> \$COMMERCIALITY_VAL . "\"/>
>
> each of those php variables are currently set to:
>
> \$MELODY_VAL = "0";
> \$RATING_VAL = "0";
> \$PRODUCTION_VAL ="0";
> \$COMMERCIALITY_VAL = "0";
>
> as all the sliders begin at 0.
>
> Firebug console is reporting the GET request to trackquery but it
> doesn't have any parameters on the end.
>
> Cheers
> Andy
>
> On Jul 31, 2:32 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
> wrote:
> > its not "Request=null" its request=null as the object is assigned to
> > "request" at var request=new Ajax....
> > You should pastebin your whole page it is being called on so i can see
> > why
> > the elements are null ... they are taken direct from your code and \$()
> > is
> > merely a shortcut for document.getElementById()...
>
> > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > ----- Original Message -----
> > From: "Andrew Dodd" <a...@slicethepie.com>
> > To: "Prototype & script.aculo.us"
> > Sent: Friday, July 31, 2009 2:26 PM
> > Subject: [Proto-Scripty] Re: Effect.Morph query
>
> > Wicked.
>
> > I've edited it and think it's ok. the params are being passed as null
> > though. Here is your revised ajaxFunction as I've implemented it:
>
> >http://pastie.org/566649
>
> > But the response I get back is:
>
> > Notice: Undefined index: Melody in includes\functions\trackQuery.php
> > on line 5
>
> > Notice: Undefined index: Production in includes\functions
> > \trackQuery.php on line 6
>
> > Notice: Undefined index: Rating in\includes\functions\trackQuery.php
> > on line 7
>
> > Notice: Undefined index: Commerciality in\functions\trackQuery.php on
> > line 8
>
> > Notice: Undefined index: SearchID in includes\functions\trackQuery.php
> > on line 9
>
> > Any idea why this might be happening, it worked with the old
> > ajaxFunction.
>
> > Cheers
> > Andy
>
> > On Jul 31, 1:02 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
> > wrote:
> > > I would replace all of your code with the Ajax.Updater...
>
> > >http://pastie.org/566564
>
> > > I have put most of it into the pastie above.... You will want to check
> > > it
> > > and replace your code with it if you are happy.
>
> > > Regards
>
> > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > ----- Original Message -----
> > > From: "Andrew Dodd" <a...@slicethepie.com>
> > > To: "Prototype & script.aculo.us"
> > > Sent: Friday, July 31, 2009 12:49 PM
> > > Subject: [Proto-Scripty] Re: Effect.Morph query
>
> > > I've replaced the script with the new one but I'm struggling with the
> > > syntax for including the initMorphing function. My AJAX request is
> > > posted here:
>
> > >http://pastie.org/566545
>
> > > I've put the function where I think it should go but I'm not sure if
> > > it's right, could you confirm?
>
> > > Cheers
> > > Andy
>
> > > On Jul 31, 12:34 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
> > > wrote:
> > > > You have a noticeable invalid spec on that pastie...
>
> > > > The first is all of the buttons have the same id of
> > > > "clearButton"....
> > > > Element id's should be unique.
>
> > > > If you're loading the bits via ajax then you will need to clean up
> > > > the
> > > > old
> > > > function and bind a new one each time the ajax is called.
>
> > > > There are many ways to do this, i prefer wrapping the
> > > > \$\$().invoke(........
> > > > part of the script in its own funciton and calling that either at
> > > > the
> > > > bottom
> > > > of the Ajax.Updater/Request or onSuccess.
>
> > > > For garbage colleciton (unbinding the old binds and so on to keep a
> > > > clean
> > > > scope simply
>
> > > > I have ammended the code and reposted it at....
>
> > > >http://pastie.org/566530
>
> > > > I put in a self cleaning call into the funciton for you that will
> > > > stop
> > > > the
> > > > observing and set the window.lastMorphed variable to null...
>
> > > > This should keep the window scope clean and also remove the binding
> > > > on
> > > > elements that dont exist after an Ajax.Updater.
>
> > > > You should call it in the 'onSuccess' part of your ajax
>
> > > > something like
>
> > > > onSuccess : function() {
> > > > initMorphing();
>
> > > > }
>
> > > > HTH
>
> > > > Regards
>
> > > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > > ----- Original Message -----
> > > > From: "Andrew Dodd" <a...@slicethepie.com>
> > > > To: "Prototype & script.aculo.us"
> > > > Sent: Friday, July 31, 2009 12:13 PM
> > > > Subject: [Proto-Scripty] Re: Effect.Morph query
>
> > > > I do have another question.
>
> > > > The list of elements is loaded with ajax, I think it is properly
> > > > formed for your script to work but it's here in case you want to
> > > > check:
>
> > > >http://pastie.org/566516
>
> > > > I think I need to run your script after each AJAX reload of the data
> > > > but I'm not sure how to achieve this, would the browser recognise
> > > > the
> > > > script is I echo it in the php output from the file running the
> > > > query?
>
> > > > Cheers
> > > > Andy
>
> > > > On Jul 31, 11:01 am, "Alex McAuley"
> > > > <webmas...@thecarmarketplace.com>
> > > > wrote:
> > > > > You;re more than welcome....
>
> > > > > That will give you he basis on how to do this kinda stuff without
> > > > > onclick!
>
> > > > > Anything else just let me/the group know
>
> > > > > Regards
>
> > > > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > > > ----- Original Message -----
> > > > > From: "Andrew Dodd" <a...@slicethepie.com>
> > > > > To: "Prototype & script.aculo.us"
> > > > > <prototype-scriptaculous@googlegroups.com>
> > > > > Sent: Friday, July 31, 2009 10:59 AM
> > > > > Subject: [Proto-Scripty] Re: Effect.Morph query
>
> > > > > Sorry, forgot to mention I was an idiot :)
>
> > > > > Thanks very much it works brilliantly
>
> > > > > On Jul 31, 10:39 am, "Alex McAuley"
> > > > > <webmas...@thecarmarketplace.com>
> > > > > wrote:
> > > > > > Andy you completely disregarded the onclick notes i gave you and
> > > > > > mangled
> > > > > > the
> > > > > > script.
>
> > > > > >http://pastie.org/566455
>
> > > > > > That works completely fine... all you ahev to do is remve the
> > > > > > <script src="/resources/includes/client/shrunkpse.js"
> > > > > > type="text/javascript"></script>
> > > > > > Block and put in your paths to prototype,scriptaculous,effects
> > > > > > and
> > > > > > it
> > > > > > works
> > > > > > how you want it to.
>
> > > > > > HTH
>
> > > > > > (stay away form onlick)!!
>
> > > > > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > > > > ----- Original Message -----
> > > > > > From: "Andrew Dodd" <a...@slicethepie.com>
> > > > > > To: "Prototype & script.aculo.us"
> > > > > > <prototype-scriptaculous@googlegroups.com>
> > > > > > Sent: Friday, July 31, 2009 9:54 AM
> > > > > > Subject: [Proto-Scripty] Re: Effect.Morph query
>
> > > > > > Hi
>
> > > > > > Thanks for the help, I tried the above in a clean page but I
> > > > > > can't
> > > > > > get it to work, the code as I've implemented it is here:
>
> > > > > > <script src='http://pastie.org/566433.js'></script>
>
> > > > > > Can you see where I've gone wrong (it's almost definately my
> > > > > > fault)
> > > > > > :)
>
> > > > > > Cheers
> > > > > > Andy
>
> > > > > > On Jul 30, 11:03 am, "Alex McAuley"
> > > > > > <webmas...@thecarmarketplace.com>
> > > > > > wrote:
> > > > > > > A couple of things i would do.
>
> > > > > > > First i would remove the onlick and assign the elements a
> > > > > > > classname
> > > > > > > something like this will work
>
> > > > > > >http://pastie.org/565060
>
> > > > > > > HTH
>
> > > > > > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > > > > > ----- Original Message -----
> > > > > > > From: "Andrew Dodd" <a...@slicethepie.com>
> > > > > > > To: "Prototype & script.aculo.us"
> > > > > > > <prototype-scriptaculous@googlegroups.com>
> > > > > > > Sent: Thursday, July 30, 2009 10:42 AM
> > > > > > > Subject: [Proto-Scripty] Re: Effect.Morph query
>
> > > > > > > The code is being echoed in a php script (hence the \$row and
> > > > > > > \$class
> > > > > > > variables but they do translate properly) I've pasted it
> > > > > > > below:
>
> > > > > > > onclick="Effect.morph(lastPlayed , {'style: \$class'}), \$('\$row
> > > > > > > [TrackID]').morph('background:#ffcc33;'),var lastPlayed =
> > > > > > > ''\$row
> > > > > > > [TrackID]';"
>
> > > > > > > This is one of my many failed attempts.
>
> > > > > > > Thanks for the help
>
> > > > > > > Cheers
> > > > > > > Andy
>
> > > > > > > On Jul 30, 10:26 am, "Alex McAuley"
> > > > > > > <webmas...@thecarmarketplace.com>
> > > > > > > wrote:
> > > > > > > > Can you give an example of your code in a pastebin and i
> > > > > > > > will
> > > > > > > > ammend
> > > > > > > > it
> > > > > > > > to
> > > > > > > > do what it needs to.
>
> > > > > > > > Regards
>
> > > > > > > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > > > > > > ----- Original Message -----
> > > > > > > > From: "Andrew Dodd" <a...@slicethepie.com>
> > > > > > > > To: "Prototype & script.aculo.us"
> > > > > > > > <prototype-scriptaculous@googlegroups.com>
> > > > > > > > Sent: Thursday, July 30, 2009 10:23 AM
> > > > > > > > Subject: [Proto-Scripty] Re: Effect.Morph query
>
> > > > > > > > I'm not really sure how to, I've been messing with it for
>
> ...
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to