Here is a script I wrote.
the form name is addaccess and the field name is iaccinv. however I do have 5 fields all with the same name. as shown below. I need the fields to have the same name.
if I enter a number not in the array it should bring up a alert window and reset the field to blank. When I run the above with a bad number I get the alert but the field does not get reset.
Any suggestions?
Code:
<SCRIPT LANGUAGE="JavaScript">
function CheckAccess(f) {
var allowableInvestors = new Array();
allowableInvestors["001"]="001";
allowableInvestors["004"]="004";
if (f != allowableInvestors[f]) {
alert ("I'm sorry, you do not have proper rights to give access to investor " + f + " thank you.");
addaccess.iaccinv.value = " ";
}
}
</SCRIPT>
the form name is addaccess and the field name is iaccinv. however I do have 5 fields all with the same name. as shown below. I need the fields to have the same name.
Code:
<form name="addaccess">
<tr><td class="dcolor"><b>Investor: </b><input type="text" size="20" name="iaccinv" onChange="CheckAccess(this.value)"></td><td width="5" class="dcolor"></td><td class="dcolor"><b> Pool: </b><input type="text" size="20" name="iaccpool"></td></tr>
<tr><td class="dcolor"><b>Investor: </b><input type="text" size="20" name="iaccinv" onChange="CheckAccess(this.value)"></td><td width="5" class="dcolor"></td><td class="dcolor"><b> Pool: </b><input type="text" size="20" name="iaccpool"></td></tr>
<tr><td class="dcolor"><b>Investor: </b><input type="text" size="20" name="iaccinv" onChange="CheckAccess(this.value)"></td><td width="5" class="dcolor"></td><td class="dcolor"><b> Pool: </b><input type="text" size="20" name="iaccpool"></td></tr>
<tr><td class="dcolor"><b>Investor: </b><input type="text" size="20" name="iaccinv" onChange="CheckAccess(this.value)"></td><td width="5" class="dcolor"></td><td class="dcolor"><b> Pool: </b><input type="text" size="20" name="iaccpool"></td></tr>
<tr><td class="dcolor"><b>Investor: </b><input type="text" size="20" name="iaccinv" onChange="CheckAccess(this.value)"></td><td width="5" class="dcolor"></td><td class="dcolor"><b> Pool: </b><input type="text" size="20" name="iaccpool"></td></tr>
<tr><td class="dcolor"><b>Investor: </b><input type="text" size="20" name="iaccinv" onChange="CheckAccess(this.value)"></td><td width="5" class="dcolor"></td><td class="dcolor"><b> Pool: </b><input type="text" size="20" name="iaccpool"></td></tr>
if I enter a number not in the array it should bring up a alert window and reset the field to blank. When I run the above with a bad number I get the alert but the field does not get reset.
Any suggestions?