Hide/Disable the Submit button based on Yes/No variable choice

shanedavis
Tera Expert

Can anyone provide help on how I can hide/disable the Submit button when a record producer Yes/No is selected?

variable type: Yes/No

variable name: software_ss_reset

Action needed: When 'No' is chosen from the record producer variable, software_ss_reset, I want the Submit button to hide OR disable.

I added the script below to the Script box in the record producer, but it is ignored as the user can still submit even though No is chosen on the variable.

//Remove the Submit button
var pwsr = producer.software_ss_reset;
if(pwsr == 'no')	{
	current.setAbortAction(true);
	gs.addErrorMessage('Please use the SOFTWARE self-reset feature instead of submitting this form');
}
1 ACCEPTED SOLUTION

Zeeshan Khan1
Kilo Guru

Hi,

 

You can implement this by creating an onSubmit catalog client script on the record producer with below code.

 

if(g_form.getValue('software_ss_reset') == 'No') {
       alert('Please use the Software self-reset feature instead of submitting this form');
       return false;
}

 

This will not hide/disable the submit button, but it will prevent user from submitting the form.

View solution in original post

11 REPLIES 11

mahi9315,

 

     Both "no" and "No" showed in the alert so both worked as far as the alert, but neither disabled/hid the Submit button.  The solution that I marked as correct justified my need so no further actions are required.  I really appreciate your help.  Thank you very much.

 

Shane

You have to be careful with scripts like this.  This would not work in the Service Portal if you are using it or start to use it in the future.  $$ is not supported coding.