[SOLVED] Submit on JS-Event

mudshark79

Member
I'm sure there is quite a simple way to "push the submit button" via a Element-JS? Even though reading and trying quite something I didn't find out yet...

Can someone point me to the right direction, please?

Thanks
 
Try ...

Code:
var form = Fabrik.getBlock('form_X');
form.doSubmit(new Event.Mock(form._getButton('Submit')), form._getButton('Submit'));

Replace X with the numeric ID of your form, like form_7.

-- hugh
 
Try ...

Code:
var form = Fabrik.getBlock('form_X');
form.doSubmit(new Event.Mock(form._getButton('Submit')), form._getButton('Submit'));

Replace X with the numeric ID of your form, like form_7.

-- hugh

Thnkas, seems I was not even Close with m y own Tries :). Also I did manage to mix up Apply and Submit while posting and for the sake of completeness and because it somehow not intuitive, here the same code for "apply" with initial lower-case letter:

Code:
var form = Fabrik.getBlock('form_X');
form.doSubmit(new Event.Mock(form._getButton('apply')), form._getButton('apply'));

Regards,

Matthias
 
Thanks for the feedback.

You can also use a "non Fabrik" approach, and fake a click event on the DOM element for the button, but calling our doSubmit() method directly avoids some potential gotchas. The only wrinkle being that you have to use that Event.Mock() thing to create an event object, with a valid button as the target of the event, as doSubmit() does slightly different things depending on which button was clicked.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top