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

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.

Zeeshan,

 

     Thank you for your response.  For this case, I specifically need to hide/disable the Submit button.  

 

Shane

I don't think you can hide or disable the button but like Zeeshan has you can create an onsubmit script to prevent them from submitting it which effectively is disabling it.

Zeeshan,

 

     This worked perfectly!  I guess that I wasn't following what you were saying originally, but I just tested it and got the results that I needed.  

 

Thank you,

Shane