compare two variables on on a catalog item

dilini
Giga Expert

I'm trying to compare two variables on on a catalog item. One variable is text type variable and the other one is reference type variable. Please see below: Requestor and the Approver should be the same person.   I tried below onChange scrip. That doesn't work.

Screen Shot 2016-12-15 at 2.19.17 PM.png

Screen Shot 2016-12-15 at 2.20.44 PM.png

function onChange(control, oldValue, newValue, isLoading) {

              if (isLoading || newValue == '') {

      return;

  }

  if (g_form.getValue('infoblox_host_req_txtbox_requestor_name').toString() == g_form.getValue('infoblox_host_req__ref_approver').toString()) {

alert("The requstor and the approver cannot be the same person");

  }

  }

5 REPLIES 5

Hi Balaji,


Your scrip works. Thank you!



But, it only gives error message. still I can cancel error message and submit the form entering same name for approver and requestor.


I need to prevent submit the for if requestor and approver are same.



Thank you!


Dilini