Hi Timothée
Simply try removing this "with" parameter: it's (often) useless, as
the form values will be serialized and posted by default...
As I already said before, I advise you to use Firebug for ajax troubleshooting.
+++++++
Clément
On Wed, Jun 11, 2008 at 9:24 AM, Timothée BRENNER
<[EMAIL PROTECTED]> wrote:
> Ok, i've never written any ajax request by hand, and I think you're right
> but I can't figure out exactly what the with parameter should be in my case.
>
> It would be great if you could give me some more advice.
>
> Thank you for your time.
>
>
> 2008/6/10 clemos <[EMAIL PROTECTED]>:
>>
>> Hi teum
>>
>> I think your problem is here :
>>
>> > <?php echo $ajax->submit("Go! Go! Go!", array("with" => "testform")); ?
>> >>
>>
>> the "with" option should be "A Javascript expression specifying the
>> parameters for the XMLHttpRequest. This defaults to
>> Form.Element.serialize('$field'), which can be accessed from
>> params['form']['field_id']"
>>
>> Though not mentionned in AjaxHelper::submit, it is mentionned here:
>>
>> http://api.cakephp.org/class_ajax_helper.html#7910bf5f8ff355ecbbac3706ab97d283
>>
>> +++++++
>> Clément
>>
>> On Tue, Jun 10, 2008 at 5:08 PM, teum <[EMAIL PROTECTED]> wrote:
>> >
>> > Hi,
>> >
>> > I've been using google for too long now and I still haven't found what
>> > I am looking for. I'm just trying to submit a form using ajax (Cake
>> > 1.2) and I'm going through hell. It is supposed to be simple with
>> > cakephp so I must be really bad... Without ajax it works.
>> >
>> > Here's my form :
>> >
>> > <?php echo $ajax->form('index', 'post', array('update' => 'content',
>> > 'id' => 'testform')); ?>
>> > <?php echo $form->input('critere_tri', array('options' =>
>> > array("Participant.magasin_id" => "Magasin"))); ?>
>> > <?php echo $ajax->submit("Go! Go! Go!", array("with" => "testform")); ?
>> >>
>> > <?php pr($data); // To verify if the request is successful ?>
>> >
>> > The controller :
>> >
>> > class CreationsController extends AppController
>> > {
>> > var $name = "Creations";
>> > var $components = array("Auth");
>> > var $uses = array("Participant", "Creation");
>> > var $helpers = array('Form', 'Ajax');
>> >
>> > function index()
>> > {
>> > if(!empty($this->data)
>> > $this->set($this->data); // To verify if the
>> > request is successful
>> > $this->set("participantsMagasinCreations",
>> > $this->Participant-
>> >>findAll());
>> > }
>> > }
>> >
>> > I want to get the value from the list and use it in the findAll()
>> > order condition. For the moment I just display it. But it doesn't
>> > work.
>> >
>> > There's the following javascript error : "testform is not defined".
>> > And I checked in the source of the document, the form has
>> > "id='testform' ...
>> >
>> >
>> > Thanks in advance for helping me.
>> >
>> >
>> > >
>> >
>>
>>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---