Hi everyone,

I'm a newbbie on javascript... I'm trying to develope a js to compare the first two letters of two fields... Any help would be appritiated!!!!

Thanks
Chris

You probably meant to post your question here

i dont get what you asked, can you elaborate your requirements ??

first two letters of two fields ? k ..
got it now .. is it from same form or wat ?
use the split function. or store the fields value in an array and compare the first two letters in the array !!

[img]http://www.bdominant.com/images/search-engine-optimization.jpg[/img]search engine optimization

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.
EX.
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?

Many thanks
CP

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.