I use this code to validate one field on a form.
I have two questions 1. is how do i change this so instead of checking text lenght it checks for Bad words IE:cat dog horse and doesnt let then enter any of the words in the list.
My next question is this will check one field at the moment it checks "NAME" lets say i want this one script to check two fields how would i change it? and if i wanted to check the lenght of this field and check if there was any bad words in the same fields.
I assume this would be 2 scripts but the ONSUBMIT only checks one script.
<script language="javascript">
<!---
function checklength(Daform)
{
var strName = form.Name.value;
if (strName.length < 3)
{
alert('you must enter at least 3 characters.');
return false;
}
return true;
}
//-->
</script>
onSubmit='return checklength(this);'
any help would be great.
I have two questions 1. is how do i change this so instead of checking text lenght it checks for Bad words IE:cat dog horse and doesnt let then enter any of the words in the list.
My next question is this will check one field at the moment it checks "NAME" lets say i want this one script to check two fields how would i change it? and if i wanted to check the lenght of this field and check if there was any bad words in the same fields.
I assume this would be 2 scripts but the ONSUBMIT only checks one script.
<script language="javascript">
<!---
function checklength(Daform)
{
var strName = form.Name.value;
if (strName.length < 3)
{
alert('you must enter at least 3 characters.');
return false;
}
return true;
}
//-->
</script>
onSubmit='return checklength(this);'
any help would be great.