Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

use jquery .submit() to submit a form?


Reply


3 Posts   1472 Views

Avatar
marblegravy

Community Member, 19 Posts

7 October 2010 at 11:00am

Edited: 07/10/2010 11:01am

I've built a bunch of form checks, validations and actions in javascript with jquery and am trying to load it in to a Silverstripe page and use the built in form handling to do the final sending of the emails.
The problem I've got is trying to figure out how to submit the form from javascript.

I've tried using jQuery's .submit() method, but it doesn't work.

I suspect I need to modify the way that this line behaves in my form code:

    return new Form($this, 'QuoteForm', $fields, $actions);

adding in a 5th parameter where validation normally fits, but again I'm stuck trying to figure out how to specify my own validation function.

Can anyone help, or should I post a more thorough example?

Avatar
FullWebService

Community Member, 38 Posts

7 October 2010 at 9:25pm

Edited: 07/10/2010 9:25pm

There shouldn't be a problem using jQuery .submit(). You do have to disable the standard validation javaScript. This article explains how to use custom jQuery validation [url]http://ssbits.com/tutorials/2009/using-jquery-for-form-validation/[/url]. Hope it helps!

Avatar
marblegravy

Community Member, 19 Posts

14 October 2010 at 10:36am

Sorry for the delay - I've been too busy using my new found power to manipulate forms!

Thanks heaps for that link - it was exactly what I was after.