- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2018 01:53 PM
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');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2018 04:50 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2018 10:52 PM
Hi Shanedavis,
You can try the below code in onChange catalog client script, I should hide the submit button:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
alert(g_form.getValue('u_hide'));
if(g_form.getValue("u_hide")=="false") {//you can type your variable name and variable value instead of 'false' over here
$$('button[id=sysverb_update]').each(function(elmt) { // you can check the ID of your submit button and update the id over here
elmt.style.display = 'none';
});
g_form.addErrorMessage("Please use the SOFTWARE self-reset feature instead of submitting this form");
} else {
$$('button[id=sysverb_update]').each(function(elmt) {// you can check the ID of your submit button and update the id over here
elmt.style.display = 'inline';
});
}
}
Please let me know if this code don't work for you.
Please mark it correct, if it resolves your problem.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2018 09:07 AM
Hi mahi9315,
I tested your code with my values and am not able to get the Submit button to show nor hide when No is chosen. Below is the updated code. The id of my Submit button shows as submit_button. The alert and error message was removed for my code as those are not required.
Thank you for your help!
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
if(g_form.getValue("software_ss_reset")=="no") {
$$('button[id=submit_button]').each(function(elmt) {
elmt.style.display = 'none';
});
} else {
$$('button[id=submit_button]').each(function(elmt) {
elmt.style.display = 'inline';
});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2018 11:54 PM
Hi
It should work, could you please try with
if(g_form.getValue("software_ss_reset")=="No")
and also please put alert in client script to check what value you are getting in 'g_form.getValue("software_ss_reset")'. I am getting "Yes" OR "No".
Please check and let me know if it don't work.
Please mark it correct, if it resolved your problem
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2018 09:57 AM
Hi mahi9315,
I used the code below and, when I choose "No" on my variable, I get the alert with the word "No" and an OK button. However, I am still able to Submit the ticket.
I used the button id "submit button" because, when I analyze the button using Chrome's debug tools, that is what the id shows.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
alert(g_form.getValue('software_ss_reset'));
if(g_form.getValue("software_ss_reset")=="no") {
$$('button[id=submit_button]').each(function(elmt) { // you can check the ID of your submit button and update the id over here
elmt.style.display = 'none';
});
g_form.addErrorMessage("Please use the Five9 self-reset feature instead of submitting this form");
} else {
$$('button[id=submit_button]').each(function(elmt) {// you can check the ID of your submit button and update the id over here
elmt.style.display = 'inline';
});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2018 11:20 PM
I can still see "no" in your if condition instead of "No". did you checked with "No" in your if condition instead of "no". Could you please check this. Also I can see, you marked one of the solution as "correct", is your issue resolved?