onsubmit client script

Sneha39
Mega Guru

OnSubmit client script.

 

Variable is select box type. ( choices are 1. Select, yes, no) so I want user should select choice, form should not get submitted if choice value is  Select or empty.

 g_form.show error not working.

Thanks

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

in the onsubmit client script, write like this.

//Update the field names and values correctly as per your code.

if(g_form.getValue("choice_field") == "select" || g_form.getValue("choice_field") == '') {

g_form.addErrorMessage("please select the choice")

return false;

}

View solution in original post

2 REPLIES 2

asifnoor
Kilo Patron

in the onsubmit client script, write like this.

//Update the field names and values correctly as per your code.

if(g_form.getValue("choice_field") == "select" || g_form.getValue("choice_field") == '') {

g_form.addErrorMessage("please select the choice")

return false;

}

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sneha,

what is your exact code? can you post it here

it should be simple

function onSubmit(){

if(g_form.getValue('<column>') == ''){

return false;

}

}

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader