prevent catalog item submission based on value of variable in form

mhunter
Tera Contributor

Hello,

I am trying to set up a catalog UI policy to prevent users from submitting a request for a new phone number if they do not have a physical phone yet.

this is the solution I've come up with so far, however, the requests are still being submitted

 
function onSubmit() {
    var phone = g_form.getValue('physical_phone');
    if (phone == 'No') {
        alert(getMessage('A physical phone is needed before requesting a new phone number'));
        return false;
    }
}
1 ACCEPTED SOLUTION

Zach Koch
Giga Sage
Giga Sage

Why are you trying to do this in a UI policy instead of doing this in an onSubmit client script? The onSubmit client script would be looking for true or false, while the UI action doesn't know what to do with the true or false.

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

View solution in original post

3 REPLIES 3

Zach Koch
Giga Sage
Giga Sage

Why are you trying to do this in a UI policy instead of doing this in an onSubmit client script? The onSubmit client script would be looking for true or false, while the UI action doesn't know what to do with the true or false.

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

i think thats what my issue was!!! thank you

Great! You are welcome and I'm glad that solved it for you.

 

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!