PDA

View Full Version : jquery form to formwizard script : Disable 'next' button



Yaresh
08-04-2011, 09:47 PM
1) Script Title: jquery form to formwizard script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...formwizard.htm

3) Describe problem: I have an ajax routine that checks email not in db when user exits email field. This pops an alert but I would like to disable the "next" button on the current section/page until user inputs valid address.
How would I do this / interface with the formwizard validation routine?
Any suggestions?
Or, modifying the formwizard.js, what var should I use to assign an id to the 'next' span on the sections? If they had an id I could interface with that.
I tried altering the line:


var $paginatediv=$('<div class="formpaginate" style="overflow:hidden;"><span class="prev" style="float:left">Back</span> <span class="status">Step 1 of </span> <span class="next" id="'+ i + '" style="float:right">Next</span></div>')

But it seems "i" is not the right reference.
Thanks
Yaresh

ddadmin
08-06-2011, 06:17 PM
Or, modifying the formwizard.js, what var should I use to assign an id to the 'next' span on the sections? If they had an id I could interface with that.

Giving the "next" span a unique ID value is simple enough. Just replace the original line you cited above with the below instead:


var $paginatediv=$('<div class="formpaginate" style="overflow:hidden;"><span class="prev" style="float:left">Back</span> <span class="status">Step 1 of </span> <span class="next" style="float:right" id="'+setting.formid+'_next">Next</span></div>')

With it the "next" span now carries an ID value of "formid_next", where "formid" is the ID value of your FORM element, such as "feedbackform_next".

If being able to access the "next" span directly doesn't suffice in accomplishing what you want, take a look at using the onpagechangestart event handler (http://dynamicdrive.com/dynamicindex16/formwizard_suppliment.htm) in conjunction.

Yaresh
08-07-2011, 01:38 PM
Thanks very much for that. Actually I was hoping to assign an unique id to each NEXT span on the form.
Yaresh