From: <mr...@us...> - 2004-09-10 16:22:10
|
Update of /cvsroot/struts/struts-flow/src/wizard-example/WEB-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9823 Modified Files: wizard.js Log Message: Added more documentation Index: wizard.js =================================================================== RCS file: /cvsroot/struts/struts-flow/src/wizard-example/WEB-INF/wizard.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wizard.js 10 Sep 2004 00:50:53 -0000 1.1 --- wizard.js 10 Sep 2004 16:21:55 -0000 1.2 *************** *** 55,59 **** --- 55,62 ---- // Shows the form, handling validation and navigation Wizard.prototype.showForm = function(frm, bizdata, doValidate) { + + // Default validation to true if not passed doValidate = (doValidate == void true ? true : doValidate); + var lastWebCont = lastContinuation; // create a continuation, the invocation of which will resend *************** *** 61,64 **** --- 64,70 ---- var wk = startContinuation(lastWebCont); log.debug("saving spot "+wk.id+" before form:"+frm); + + // Loop to keep showing form until validation passes and next button + // is pressed var keepShowing = true; var thisWebCont; *************** *** 66,75 **** --- 72,90 ---- while (keepShowing) { keepShowing = false; + + // Wraps the model before attaching to bizdata to allow any necessary + // cloning or ActionForm wrapping tmpModel = this.prepareModel(this.model); bizdata[this.modelKey] = tmpModel; + + // Send the form and wait thisWebCont = this.sendFormAndWait(frm, wk, bizdata); + + // Populate the model with form submission this.populate(); this.postPopulate(); + // If validation is enabled, validate and determine if should keep + // showing if (doValidate) { errors = this.validate(frm); *************** *** 82,85 **** --- 97,101 ---- } + // Determine if next button is pressed and should stop showing if ((doValidate && !keepShowing) || !doValidate) { keepShowing = true; |