how to pass parameter to $ajax->link ??

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

how to pass parameter to $ajax->link ??

Samuel-22

Hi all:
    One questino is that.I create a test field for tag input
  <input type="text" name="addtag" /> and then use

$ajax->link('add',array('fallback'=>'#addtag','url'=>"../umanager/addTag",'update'=>'somearea'...));
   I want to kown that how to pass the data form the test field to the
link when clicking 'add ' .so it can be passd to the controller?? It is
simple I think but seems I can not find the solution....thank you all
!!!
   And where can i get the full definitions for  the ajaxOptions??
Thank you!!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: how to pass parameter to $ajax->link ??

Bert Van den Brande

Lots of Ajax helper info here : http://manual.cakephp.org/chapter/helpers

On 11/2/06, Samuel <[hidden email]> wrote:

>
> Hi all:
>     One questino is that.I create a test field for tag input
>   <input type="text" name="addtag" /> and then use
>
> $ajax->link('add',array('fallback'=>'#addtag','url'=>"../umanager/addTag",'update'=>'somearea'...));
>    I want to kown that how to pass the data form the test field to the
> link when clicking 'add ' .so it can be passd to the controller?? It is
> simple I think but seems I can not find the solution....thank you all
> !!!
>    And where can i get the full definitions for  the ajaxOptions??
> Thank you!!
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: how to pass parameter to $ajax->link ??

cadraig

Samuel,
I had a similar problem, I don't know what the correct answer is, but I
got around it by
putting the  $ajax code into the view without any parameters.  Viewing
the source gives you the generated javascript, which you can then copy
out of there and paste into your own view, replacing the $ajax code.
Then you can simply insert the js parameter eg. + id or whatever
I would be very interested if anyone has the correct solution allowing
us to stay within cake. :)


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: how to pass parameter to $ajax->link ??

leo.cacheux

I did something like this with an autocompleter, it should not be very
different with an Ajax link.

Use a fixed Id for your link (called MyLinkId in the example) and for
your input (MyTextId), and in the "onchange" property for your input,
try this :

lnk = document.getElementById('MyLinkId');
txt = document.getElementById('MyTextId');
lnk.url = '/umanager/addTag/' + txt.value;

I didn't tried this code but something like this should work.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: how to pass parameter to $ajax->link ??

Samuel-22
In reply to this post by Bert Van den Brande

thanks Bert Van den Brande ,i have not reallized that the manuel has
been updated :)


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: how to pass parameter to $ajax->link ??

Samuel-22
In reply to this post by leo.cacheux

thanks leo ,I will try it later.seems it will do :)


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---