Hi Matthew,

If you use this method to attach the javascript routine to the submit
button, then in the foobar routine setup an xhrPost to process the form,
should I still have an action and a method setup in my controller when I
instantiate my form?

I've been playing with a Zend_Dojo_Form which I would like to process using
an xhrPost, but I can't seem to get it to work the way I'd expect. 

There are a couple scenarios I understand.

1. Using a Zend_Form. Create the form, set the action to
'/controller/action' and method to 'post'. Submit will call that action and
we're happy.

2. Using a Zend_Dojo_Form. same as above right?

Then the one I don't understand...

3. Using Zend_Form or Zend_Dojo_Form processing via xhrPost. set the url in
the xhrPost to '/controller/action' .. then what?

Any help would be appreciated. 

Thanks



Michael Gruschwitz wrote:
> 
> Matthew Weier O'Phinney:
>>     <? $this->dojo()->javascriptCaptureStart() ?>
>>     var foobar = function() {
>>         // ...
>>     }
>>     <? $this->dojo()->javascriptCaptureEnd() ?>
>> 
>> In you form element, add the 'onclick' property:
>> 
>>     $element->onclick = 'foobar';
>> 
>>     // or at instantiation:
>>     $element = $form->addElement('submitButton', 'submit', array(
>>         'onclick' => 'foobar',
>>         'label'   => 'Submit Form',
>>     ));
>> 
>>     // or a configuration key:
>>     form.elements.submit.options.onclick = "foobar"
>> 
>> Hope that helps!
>> 
> 
> Thanks for reply.
> 
> That's nearly the solution. I wrote a dojo widget for the ajax purpose,
> that is, why I cannot really use the onclick attribute.
> 
> But your first advice is very helpfull - I now just do:
> <? $this->dojo()->javascriptCaptureStart() ?>
> dojo.addOnLoad(function() {
>       // ... create widget and start it
> });
> <? $this->dojo()->javascriptCaptureEnd() ?>
> 
> So thanks a lot!
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Dojo_Form---XHR-Post-tp19360770p22314688.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to