Thanks for your response, it was helpful. Sounds like the word Helper
is just what it says it is, and that's it. Helpers can't do the full
job, but they help out where they can. I'm starting to realize that
now with Cake.

On Jan 28, 7:46 pm, Sidney <aussiealthomp...@gmail.com> wrote:
> I'm not sure if it's 'recommended', but I found quite quickly that the
> scope of the $ajax helper becomes too limited (you just can't get
> enough code into the array param). The solution is then to start
> coding javascript using prototype functions directly and take full
> control.
>
> Prototype makes ajax quite simple:http://www.prototypejs.org/api/ajax/
>
> Something like:
> $('select-field').observe('change', respondToChange);
>
> function respondToChange(event) {
> //some logic here
>  new Ajax.Updater('your-div', '/your/url/'.$('select-
> field').value);     //note that it's better to specify params using
> 'parameters' array
>
> }
>
> The helper is great for simple stuff, but as soon as you need some
> logic in there, then making the step up to native prototype is
> worthwhile.   (Though it might bereplaced with Jquery in future
> releases)
>
> An (unrelated?) tip to note is that if you pass javascript in the ajax
> response (i.e. you shift your logic to the server and send down some
> instructions for the browser to process) you can quickly get into
> scoping problems which are tough to debug.
>
> Note I am a novice, but I have just been through this for a site I am
> working on which is heavy ajax and blingy UI. Maybe someone can
> correct me here?
>
> HTH,
> Al.
>
> On Jan 28, 1:20 am, Pyrite <thelette...@gmail.com> wrote:
>
>
>
> > Instead of observing a select field to make an ajax request to a
> > controller action onchange,
>
> > I want the onchange to call a custom javascript function that will do
> > some logic and then make the ajax request to the controller and update
> > a div afterwards.
>
> > So .. how would I do that?
>
> > Or, I guess i could just use $ajax->observeField if I can grab the
> > contents of the select i am observing and pass it to the 'url'=> of
> > the observeField param?
>
> > Eg. $ajax->observeField('someSelect', array('url'=>'myControllerAction/
> > someSelectContentsHere'));
>
> > I need to grab the selected value of the select and pass it to the URL
> > param of observeField, any way to do that?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to