Ok, I'm using a CRM Application and I have a Field call X wich have another dependent field called Y. The First dield must be field with a number form 20-80 and the second field with the two digit of the first one plus 4 more digits.
Field #1 : 21
Field #2: 210132
I need to validate the imput before store it into the DB. How can I store the fields value in an array and compare the first two letters in the array?
Just grab hold of the field values using either document.getElementById('elementId') or document.forms['frmName'].elements['elementName'] , store it in variables and compare the characters at the first index of both the strings (make sure you use trim).