Onsubmit catalog client script not working properly

Aindrila Mondal
Tera Expert

Onsubmit catalog client script not working properly. Need to display an errormessage for some specific countries selected on the catalog form & disable the submit button simultaneously. We have written an on submit client script for that where we are checking the condition and then returning false, which seems to work perfectly but only the first time we click on submit button.

If someone modifies to a correct country and then click on onsubmit again, submit functionality doesn't seem to work  and request is not getting raised.

 

snap of the onsubmit script:

AindrilaMondal_0-1665488400916.png

 

Any help regarding the same is appreciated.

 

Thanks,

Aindrila

 

1 ACCEPTED SOLUTION

Yeah that is because, the onsubmit cline script will only when there is a submit action performed on the portal.

 

I would suggest you this:- Change the script to Onchange client script and then if the user select wring country you show them the error message but also clear out the country field using g_form.clearValue('countryvariablename').

 

So this way you will be able to show them the error message and they will also have to select the correct country before proceeding further

 

Please mark my country as correct based on Impact.

View solution in original post

6 REPLIES 6

Yeah that is because, the onsubmit cline script will only when there is a submit action performed on the portal.

 

I would suggest you this:- Change the script to Onchange client script and then if the user select wring country you show them the error message but also clear out the country field using g_form.clearValue('countryvariablename').

 

So this way you will be able to show them the error message and they will also have to select the correct country before proceeding further

 

Please mark my country as correct based on Impact.

Thanks for this solution this sounds and works better.