hi all i have 2 javascript one is simple login form and other is username function.i want to fit username function into login form because username function will allow special characters.below is my login form .. <html><head><meta charset="utf-8"><title>Simple Registration Form</title><script type="text/javascript"> function checkName(form) /* for real name verification */ { var oRE = /^[a-z0-9]+[_.-]?[a-z0-9]+$/i; var isCorrectFormat = oRE.test(text); if (!isCorrectFormat) { alert("Invalid characters in username. It can only contain..."); return false; }

first script is a complete registration form with username not accepting special characters.then i have written the second script exclusively for username accepting atleast one special characters just to check working or not.it is working perfectly so i need to replace the checkname function in first form with second script i have written.so that only one script will be there to accept username with at least one special characters..

guido2004
—
2011-07-21T07:36:03Z —
#3

Please put code tags around the code you post, so it's easier to read and understand.

And it looks to me like you already have the exact same check on name in the first script. What is it that the second script does, and the first doesn't?

the function given by you is not working below is the overall javascript function for simple form.it has some errors tell me what should i do to execute the below script

"is not working""has some errors"

are not very helpful descriptions of your problem.

When you get errors, post the error messages.When it's "not working", explain what that means.

And put code tags around the code you post here!

ravi951
—
2011-07-21T09:11:55Z —
#12

<no it is not accepting.i have given var sRealname = form.realname.value;>is it right

ravi951
—
2011-07-21T09:16:44Z —
#13

<even if we give wrong output to username as ravi!951 is is not displaying error message>

guido2004
—
2011-07-21T09:19:18Z —
#14

ravi951 said:

no it is not accepting.

Accepting what?

By the way, if you go to the advanced editor when writing your posts, there is a 'select syntax' drop down in the editor's menu bar, where you can choose the coding language, and the appropriate code tags will be inserted.

ravi951
—
2011-07-21T09:25:00Z —
#15

<even if we give wrong output to username as ravi!951 is is not displaying error message as incorrect format>

guido2004
—
2011-07-21T09:34:05Z —
#16

There is no need to put < and > around everything you write. I only told you to put code tags around the code you post. The general code tags are [ code ] and [ /code ] (without the spaces). If you go to the advanced reply editor, you can choose more language specific tags in the 'select syntax' drop down box in the editor's menu.

Please post your corrected code once again (with the code tags around it )