> On Fri, Nov 6, 2009 at 9:52 PM, Dave <davidcr...@gmail.com> wrote:
> > Hello all,
> > I have a textbox that, onblur, needs to use ajax to call an action
> > with its value as a parameter.
> > now ideally this would be accomplished with
> > onblue="<?php echo $ajax->remoteFunction(array('url'=>array
> > ('controller'=>'ratings','action'=>'rateItem',VALUE_GOES_HERE))); ?>"
> > I've tried replacing VALUE_GOES_HERE with 'this.value', this.value,
> > $javascript->codeBlock('this.value') and none of them work properly.
> > It seems like there would be a way to do this with cake. I've
> > currently solved the problem with a work around by taking the
> > javascript code generated by cake and copying and pasting it in place
> > of the $ajax->remoteFunction code. This way I can use this.value.
> > The result looks like this:
> > onblur = "new Ajax.Request('/charity/ratings/rateItem/' + this.value,
> > {asynchronous:true, evalScripts:true})"
> > This works... but I don't like breaking cake convention and it seems
> > as though there should be a "correct" way of doing this.
> > Does anybody know if there is?
> > Thanks in advance!
> With the corresponding view to the remote function
> call set a variable in a hidden field. And then, in the
> "oncomplete" attribute, use something like
> Form.Element.setValue('YourField', $F('HiddenField'));
> Best regards.
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105