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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.