Yammaski wrote on 09 dec 2005 in comp.lang.javascript
:
In this code the field must have at least 3 characters : (var
minLength = 3;)
Code:
// check for Voornaam
if (document.Registreren.Voornaam.value.length < minLength) {
alert('You have to fill in at least 3 characters');
return false;
}
I want to chance the code, so that they have to fill in something, it
may not stay empty.
Not empty is the same as at least 1 char!
var minLength = 1;
function voornaamNietLeeg(x){
if (x.Voornaam.value.length < minLength) {
alert('You have to fill in at least '+minLength+' character[s]');
return false;
}
return true;
}
...............
<form onsubmit='return voornaamNietLeeg(this)'>
<input name='Voornaam'>
....
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)