mast3r
09-03-2003, 09:03 AM
i have this script for one of my forms. What i want to do is in fields 1,2 and 9 i want to make sure only numbers are placed in the fields. The same for field 3 but allowing "." to be placed in abviously.
Thanks guys/gals
<script language=j"avascript">
function checkForm(form)
{
var aChk =
[
[form.Telephone_Number_of_ADSL_line, "Field 1"],
[form.CBUK_Number, "Field 2"],
[form.IP_attempting_to_use, "Field 3"],
[form.Has_ADSL_ever_worked, "Field 4"],
[form.Are_all_filters_in, "Field 5"],
[form.Does_phone_work_on_ADSL_line, "Field 6"],
[form.Filters_or_SSFP, "Field 7"],
[form.Customer_Contact, "Field 8"],
[form.Customer_Tel, "Field 9"],
[form.Equipment, "Field 10"],
[form.youremail, "Field 12"]
];
var aMsg = new Array;
for ( var i = 0; i < aChk.length; i++ )
{
if ( aChk[i][0].value == "" ) aMsg.push(aChk[i][1]);
}
if ( aMsg.length > 0 )
{
alert(aMsg.join(', ') + " are Missing. Please go back and fill in the missing information. Thankyou");
return false;
}
}
</script>
Thanks guys/gals
<script language=j"avascript">
function checkForm(form)
{
var aChk =
[
[form.Telephone_Number_of_ADSL_line, "Field 1"],
[form.CBUK_Number, "Field 2"],
[form.IP_attempting_to_use, "Field 3"],
[form.Has_ADSL_ever_worked, "Field 4"],
[form.Are_all_filters_in, "Field 5"],
[form.Does_phone_work_on_ADSL_line, "Field 6"],
[form.Filters_or_SSFP, "Field 7"],
[form.Customer_Contact, "Field 8"],
[form.Customer_Tel, "Field 9"],
[form.Equipment, "Field 10"],
[form.youremail, "Field 12"]
];
var aMsg = new Array;
for ( var i = 0; i < aChk.length; i++ )
{
if ( aChk[i][0].value == "" ) aMsg.push(aChk[i][1]);
}
if ( aMsg.length > 0 )
{
alert(aMsg.join(', ') + " are Missing. Please go back and fill in the missing information. Thankyou");
return false;
}
}
</script>