Bart Molenkamp wrote:

Hi all,

Currently, in flowscript, you display a form by calling
form.showForm(uri). This function loops until the form is successfully
processed. There is, as far as I can see, no way to get between there.

I wonder if it would be useful to define two more functions in Form.js,
that allow me to have better control over displaying/processing a form.
E.g. something like:

var form = new Form("form.xml");

...

var finished = false;
do {
form.showPage("form-template.xml"); // show the form only once.
if (user clicked some link) {
...
// dome something else
} else {
finished = form.process(); // process the form only once.
}
} while (!finished);


In this case, I do the looping that is otherwise done in the
form.showForm() function. But now I have more control over the form
flow. And, form.showForm() still exists and can be built using the above
two new methods.

I can make this change. Would it be valuable addition for CForms, or
not?



You can already to this without having to insert some code within the showForm loop (which BTW is no more a loop in 2.1.7): you can place an <fd:submit validate="false"> that will exit the shorForm function.


The corresponding flowscript could then look like:

var redisplayForm = true;
while(redisplayForm) {
   form.showForm();
   switch(form.submitId) {
       case "details":
           showDetails();
           break;
       case "create":
           createNew();
           break;
       case "cart":
           redisplayForm = false;
           showCart();
           break;
       case "ok":
           redisplayForm = false;
           processForm(form);
           break;
   }
}

Does it answer your need?

Sylvain

--
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director



Reply via email to