SR3: Form OnSubmit Function

The form OnSubmit function is documented for SR1 (pg 206), but it is missing (and I can't get it to work) in SR3

 

31.8 OnSubmit and OnCancel Functions
You can specify a script function to be called when a form's OnSubmit or OnCancel event handler is used.
To do this:
1. In the Designer, use the Scripts dialog to create a script function.
2. Select the form to which you want to assign the script function.
3. From the form's Client Extensions field, start the Integration Wizard.
4. From the Form extensions category, select the Run a submit script or Run a cancel script item and
click the Next button.
5. Complete the required information for the OnSubmit or OnCancel function.
An OnSubmit function must return a Boolean value. If the script returns:
• False, the submit action fails.
• True, the submit action succeeds.
This enables a process designer to submit only forms that validate.

Tagged:

Comments

  • It definitely does work in 9.0.3. You must return "true" for the form to submit, "false" to prevent it.

     

    I suspect there is something else in your code that has changed.

  • all I put in the OnSubmit was "return false"

  • What version are you referring to, BTW? I assumed 9.0.3, but this mentions the Integration Wizard from v7/ 6 / 5.

  • I am on 9.0.3, but I copied and pasted from the 9.0.1 designer doc

  •  


    RKushner wrote:

    I am on 9.0.3, but I copied and pasted from the 9.0.1 designer doc


     

    Beauty!

     

    I missed that in my documentation errata. There is no end of 'copy & paste' to filter through in the version 9 docs!

  •  


    RKushner wrote:

    all I put in the OnSubmit was "return false"


    did you put the semi-colon too?

     

  • I am writing vbscript, but I guess I can try doing it with jscript...

  • I changed the script to jscript, and now the form doesn't open up. The little wheel just keeps going round and round.

     

    Does all of the script in a process have to be the same kind? (Like all vb or all j)

  • AFAIK, you can have both.

    Did you put the semi-colon in the JScript? We have lots of examples that actually work from the link below.

    I agree the documentation has been scrubbed of these events. I assume because they were wrong, but somebody forgot to add the corrected text!

  • Should "return false" work in vbscript?

  • Dunno, never use it, sorry.

  • Is there a message function is jscript, like msgbox("message")?

  • alert("hello world");

  • Is there something wrong with this:

     

    LName = getField("lname1","");
    if (LName > " ")
        return (true);
    else
        return (false);

     

    The form hangs.....

  • JScript is case sensitive. BTW, and the field names are too.

  • I don't get it. My fieldname is "lname1" all lower case. Is there something else that I got the wrong case? Do I need to use an attribute instead of the empty string?

  • I think it is GetField(), not getField()

     

    [edited to correct case (and avoid future confusion)]

  • I don't get it. You typed GetField() twice!!!

     

    Can you please give me even the shortest one line example of using getfield  in jScript?

     

    Thanx!!!

  • I think Jerome meant to post getField not GetField.

     

    The Metastorm documentation is not great and uses various different cases of the spelling - some of which are correct and some not.  p209 of the designer guide has examples but look at the code examples not the blurb that surrounds it - that will only confuse.

  • Based on the manual, I tried:

    LName = getField("lname1","items");

     

    But it didn't work. I also tried:

    LName = getField("lname1","");

     

    The manual isn't at all clear about how to use the "attribute" parameter! But I can't get it to work at all!!!!!

     

    I also tried:

    LName = GetField("lname1","items");

     

    and:

    LName = GetField("lname1","");

     

    I can't even think of other ways to try it. I can't get anything to work!!!!!!

    BTW, lname1 is my field name, all lower case.

  •  


    Paul wrote:

    I think Jerome meant to post getField not GetField.

     

    The Metastorm documentation is not great and uses various different cases of the spelling - some of which are correct and some not.  p209 of the designer guide has examples but look at the code examples not the blurb that surrounds it - that will only confuse.


     

    Yes, I did

     

    Thanks, Paul.

  •  


    RKushner wrote:

    Based on the manual, I tried:

    LName = getField("lname1","items");

     

    But it didn't work. I also tried:

    LName = getField("lname1","");

     

    The manual isn't at all clear about how to use the "attribute" parameter! But I can't get it to work at all!!!!!

     

    I also tried:

    LName = GetField("lname1","items");

     

    and:

    LName = GetField("lname1","");

     

    I can't even think of other ways to try it. I can't get anything to work!!!!!!

    BTW, lname1 is my field name, all lower case.


    This last is the only actuall valid one.

     

    I would try:

     

    var LName = GetField("lname1","");

    return true;

     

    assuming the case of the field name is correct.