Can I hide the submit button on a catalog item/record producer?

jrusso
Tera Expert

I would like to hide the Submit button on a catalog item when a variable has a certain response.

I have a Yes/No variable that if answered Yes, will display additional variables and allow the user to submit their HR Case.  However, if they answer No, I am displaying a message with a link to take the user elsewhere.  When this occurs, I would also like to hide the Submit button so that they can not submit a case.  Is it possible to do this?  

 

1 ACCEPTED SOLUTION

Hi Jrusso,

you can't hide the button without a UI Macro that manipulates DOM elements. I wouldn't recommend this as it will likely break on upgrade like you've already seen. Better user experience is to still see the 'submit' button but reject the submission with an info/error message.

We tried the DOM manipulation via a UI macro in my business and it led to users raising incidents saying the button disappeared! Always have to think of the lowest common denominator  

View solution in original post

6 REPLIES 6

Kieran Anson
Kilo Patron

Hi Jrusso,

you would need to use an onSubmit catalog client script to prevent the form being submitted.

if(g_form.getValue('variable_name') == 'No'){

g_form.addInfoMessage('<a href="google.com" target="_blank">Click here to go to somewhere else</a>');

return false;

}

 

Thank you Kieran.   Would I do this by creating a Macro variable? 

I believe our implementation partners did something like this for a similar process awhile back, but I think we lost this function when we upgraded last year.  The macro variables are still there but the submit button is now visible.

Hiya,

Macro shouldn't be needed and sounds a bit overkill to me unless you truely need to remove the submit button but I personally think that might be a bad user journey.

To add a catalog client script do the following.

Create a new Catalog Client Scripts item.

find_real_file.png

  1. Set UI Type to All
  2. Type = onSubmit
  3. Enter name of catalog item
  4. tick applies on a catalog item view

find_real_file.png

Enter the provided script in the previous post changing the name of the variable as required. Also replace the Info Message with what you want. As shown here I've used HTML to give a richer feel.

 

As you can see in the below. The 'Yes or No?' question is set to no, and when I click 'Order Now' I get the green info message with a link. As soon as I change it to yes, I'm able to submit the request

find_real_file.png

Thanks again.  this is very helpful, but will this actually hide the button so they don't have an option to click on it?  It seems that the button is there and they will get a new message/link when they click Submit.  I just want to hide the button based on an answer to a variable, so they can't click on it.  Maybe this isn't possible?