View Full Version : Please help me with this script.. Thanks :)

12-13-2009, 01:39 AM
Hi I have found a script I would like to make a few changes to.. I have tried a few tricks but got me no-where.

If you could help me I will be very much appreciated!

<script language="javascript">
//These are the names of the people you don't want

//To add a person, just put their name in quotation marks
//and add a comma after
Names = new Array(
function Check() {
//Change FORM and FIELD to the form name and field name throughout this function
awdrgy = 0
aLeRt = 0
while (awdrgy<=Names.length-1 && aLeRt!=1) {
if (namechk==Names[awdrgy]) {
aLeRt = 1
alert("Either your account is suspended or you entered an invalid email address! Please try again.")


<form name="FORM">
<input name="FIELD" onblur="Check();" onblur>
<input type="button" onclick=storytest() value="Submit" class="form">

<!-- Script Size: 2.01 KB -->

Basically What I want to happen is..

If a email entered that is listed in the reject list they will get an alert. (This currently does this)

If a email was entered that's not listed it will submit the form. (Currently does not do this)

I am making a login form that is complete but I wanted to add the above code to it..

If you or anyone could make it work the way I explained above I will be very much appreciated.



12-13-2009, 02:02 AM
This has nothing to do with either JSON or DOM, so it would be better placed elsewhere. A moderator can move it for you.

This code isn't intended to actually be used in production anywhere is it? It shouldn't be.

The form won't submit because you've not defined an action. Check out this page (http://www.w3schools.com/html/html_forms.asp) for some elementary information on HTML forms.

12-14-2009, 10:31 AM
Moved in main Javascript Forum.

Philip M
12-14-2009, 04:42 PM
<script language=javascript> is long deprecated and obsolete. Use <script type = "text/javascript"> instead.
The <!-- and //--> comment (hiding) tags have not been necessary since IE3. If you see these in some published script it is a warning that you are looking at ancient and perhaps (as here) unreliable code.

This is easily circumvented if JavaScript is disabled. JavaScript form validation only provides convenience for users, not security. This means that JavaScript should be used as an "enhancement", not as a requirement. So your form should not be dependent on JavaScript alone to perform your validation. Instead, whatever server-side language you use to process the form (PERL, ASP, PHP, etc.) should also perform the same validation. Otherwise, people will be able to bypass your validation (and even possibly inject malicious code) simply by disabling JavaScript.

Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. You can (and should) edit it to make it more meaningful.