Dev at weitling napisaƂ(a):
Hi,
as with my little daughter I need some help to do even small steps (with
Cocoon 2.1.10).
I have an ajaxed CForm with a text input and a submit button, provided
by test.fd.xml (definition), test.ft.xml (template), sitemap and test.js
for the flow.

Depending on wind and weather the browser sends 1 to 3 requests, makes
an update on continuation without (!) reaching my print-statement in the
flow, and receives one of code 200, 500 (internal server error) or 404
("undefined" not found, of course, why the heck does it call
"undefined"). On display everything is either fine, the textfield is
emptied, and/or it shows a red exclamation mark noting that (the just
filled) textfield is empty and required...


function doTest () {
    var form = new Form("test.fd.xml");
    var i = 0;
    do {
        /** called before sending Page */
        print("test #"+i);
        form.showForm("test.ft.xml");
        i++;
    } while ( form.lookupWidget("mytext").getValue() != "foo" ) ;
Everything works as expected. Let me explain it a little bit.
Firstly, showForm will not return until validation of your form not finished successfully. It means, that showForm has it's own loop that will showForm until input provided by the user is valid. That explains why your print statement is not reached, you see red exclamation mark so showForm function has not returned yet.

If you want to do your own validation you should put it into your own validator, see javascript custom validators concept:
http://cocoon.apache.org/2.1/userdocs/widgetconcepts/validation.html

Hope that helps.

--
Grzegorz Kossakowski

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to