Jump to content

Day One Noobie, Help with single line of code


jester626

Recommended Posts

First off pleae don't flame me for my ignorance.

 

I have downloaded a sample Ajax script and have managed to get it working (big feat on my part). However when using my own database I am having a problem when submitting an ID number.

 

The script came thinking the ID number would be a numeric (i.e. 1001) value, in my database the ID number is alpha-numeric (i.e. A1001).

 

The script has a line of code as such:

 

var clientId = document.getElementById('clientID').value.replace(/[^0-9]/g,'');

 

I know the problem is in te value.replace section because it is looking for strictly number where I have a letter and a number.

 

How would I work around this?

 

Thanks in advance.

After scouring the web and a lot of trial and error, I have found the solution myself.  Thought I'd post the change here in case some one else ever has this same problem

 

var clientId = document.getElementById('clientID').value.replace(/[^a-z0-9]/g,'');

 

Jester

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.