Christopher Oliver wrote:
Yes, you do. Because there will be actions you take to process the form. These are triggered by the script.
function onePageForm(form) { var obj = new MyJavaObject(); form.setModel(obj); form.sendView("theOnlyPage.xml"); // A validated form has been submitted, // process the form here: obj.processForm() }
Don't you need to call form.finish() afterwards in order to clean up?
Yes, you're right.
By the way, form.finish() takes an URI as a mandatory parameter and dispatches to it. I was thinking about implementing a parameterless version of form.finish that would just perform the necessary cleanup but not dispatch to a view. I need this to call a login form before showing a data entry form, in case the user has not already logged on. After login, I want to show the originally requested form and not a fixed one.
function login() { // initialize a new form object var form = new loginForm(); form.sendView("login"); // check credentials form.finsh(); }
function protectedForm(form) { if (user == null) { login(); } form.setModel(...); form.sendView("protected"); // etc... }
What do you think?
Agree. The page uri should be optional in Form.finish().
