Client scripts - comparing variables

Kathi
Tera Expert

I have a catalog item that I'm trying to restrict users from submitting if the request is for themselves.  In my client script I am comparing 2 fields.  If the name is the same in both fields, the alert is triggered referring them to their manager.  That piece seems to be working.  If the 2 fields are different, they should be able to continue with the request.  But when the 2 fields are different the alert is still being triggered.  I'm fairly new when it comes to JavaScript,  any help/suggestions would be appreciated.  I have attached my script.  Thank you.

1 ACCEPTED SOLUTION

So you are seeing the alert window (for the variable value), but it is empty, or does it say 'undefined' or 'null'? Have you confirmed that these are exactly the names of the variables - case-sensitive and no trailing space or anything like that?  Since this is onChange, you can use newValue for the request_access script variable, or in the if condition.  It would be super weird if you alert on newValue and it is empty, after having selected a user in the reference field.

View solution in original post

5 REPLIES 5

Ah - that could drive you crazy until you see it.  Glad to hear it's working for you now.

 

Connect with me https://www.linkedin.com/in/brad-bowman-321b1567/