The CreatorCon Call for Content is officially open! Get started here.

onSubmit Catalog Client script not working on resubmitting

Vartul Agarwal1
Tera Contributor

Hi All,

I have a onSubmit catalog client script which is checking if a question (Question 1) on the record producer is answered or not. This is checked via onSubmit catalog client script because the choices of the Question 1 are filtered based on another question (Question 2) on the record producer.

When I click submit and does not have a valid response in the Question 1 then it gives the error. After the error I select a response to the Question 1 which via a Catalog Client UI Policy makes one other question (Question 3) visible and mandatory. Now when I answer this Question 3 as well and try pressing Submit... nothing happens (checked via putting alerts in the Catalog client script that it even does not checks the onSubmit client script in this case).

If after the error I would select a response to Question 1 which does not calls any other Catalog UI Policy then it works fine and when I re submit the form it gets submitted.

Below is my onSubmit Catalog client script

function onSubmit() {

    var training = g_form.getValue('u_nature_of_this_request');

     if (training != 'waitlist' && training != 'cancel' && training != 'change_the_date') {
            g_form.addErrorMessage('Please select one response for "What is the nature of this request?"');
            return false;
      }
}

The UI Type is set to All.

The Isolate Script is not checked.

Please suggest how I could make it work that the Submit button works the second time as well in case of another Catalog UI policy ran between the first submit and second submit.

5 REPLIES 5

Hm per your code it should work, but perhaps there's something quirky with portal. I'm unsure of what version you're on, but I know things change with each release.  Perhaps this will help: https://hi.service-now.com/kb_view.do?sysparm_article=KB0779964