PDA

View Full Version : How would I make a field a required field


likegluelikecrew
12-13-2005, 01:40 PM
...and how would I have a message come up saying "these fields are required" if the user doesn't input into the required fields? I'm baffled and my boss expects this pronto, can anyone help a brother out? Thanks!

domedia
12-13-2005, 02:25 PM
1. make sure your form field that needs to be required has a name
2. Behaviours-> validate field
3. Select your named field
4. Check 'required'

davidj
12-13-2005, 02:27 PM
you need a little javascript magic


function checkflds(){
//assign fields to vars
a = document.getElementById('field1');
b= document.getElementById('field2');
c= document.getElementById('field3');
d = document.getElementById('field4');

if(a.value=='' || b.value=='' || c.value=='' || d.value=='' ){

alert("you have some fields that need filling with stuff")

}
else {

document.form1.submit():
}
}

you need to change your submit button to a normal button and add an...
onClick="checkflds()" event in your input tag

davidj
12-13-2005, 02:28 PM
dam your eyes dom

you beat me to it <_<

davidj
12-13-2005, 02:59 PM
i do however believe that validate field behaviour adds 4 ton (not 3 but 4 ton) of code

i like a tidy house therefore write my own

keep the house tidy...thats the secret :D