Clarity Service Management

Expand all | Collapse all

Forms won't submit with JS in 'onSubmit'

Jump to Best Answer
  • 1.  Forms won't submit with JS in 'onSubmit'

    Posted 05-04-2015 04:01 PM

    We are developing a Service Catalog form and would like to set the value of a field when users submit the form based on their selections. We need to run the script last thing before the form is submitted so we are trying to call it from the onSubmit attribute of the form.  The issue we are encountering is that anytime we call a script from that attribute the form won't continue to the review screen so we can submit it.


    Has anyone else encountered this issue in Catalog 12.7 and figured out a solution?

     



  • 2.  Re: Forms won't submit with JS in 'onSubmit'

    Posted 08-28-2015 12:47 PM

    At the of that script do you have something like:

    return true;



  • 3.  Re: Forms won't submit with JS in 'onSubmit'
    Best Answer

    Posted 08-31-2015 02:30 PM

    Hi Elwynn,

     

    As Duarte mentioned, your onSubmit function must return true as noted in the Administration Guide:

     

    onSubmit

     

    Specifies the JavaScript function to run when the user submits the request that contains the form.

    This function must return a Boolean value. If the function returns any value except true, the form is not submitted.

     

    Thanks!

    Jason



  • 4.  Re: Forms won't submit with JS in 'onSubmit'

    Posted 08-31-2015 03:56 PM

    Thank you for the help!

    We ended up using a workaround for this situation.

    This will be helpful to know in the future when we need to validate values on forms!

     

    Elwynn.