fri3ndly
Dec 30th 2008, 1:41 am
Hello all
I am a bit of a JS noob but have been writing it recently but something is puzzling me.
I have a name field which contains 'full name' until it is clicked. I am trying to make the js form validation pick up wjether the field contains 'full name' and if so bring up an error message, however I am having a problem with anything containing a space.
Eg. the below works:
if(fullname == "") {
inlineMsg('fullname','You must enter your full name.',2);
return false;
}
But this doesn't:
if(fullname == "full name") {
inlineMsg('fullname','You must enter your full name.',2);
return false;
}
Is there any special syntax for dealing with a space in a string?
Thanks
By the way, this is the JS error I get in Firebug:
targetdiv is null
inlineMsg("fullname", "You must enter your full name.", 2)form_validator.js (line 70)
validate(a.btn)form_validator.js (line 17)
onclick(click clientX=1252, clientY=489)8D1OtsKP...zJw%3D%3D (line 3)
[Break on this error] targetdiv.focus();
I am a bit of a JS noob but have been writing it recently but something is puzzling me.
I have a name field which contains 'full name' until it is clicked. I am trying to make the js form validation pick up wjether the field contains 'full name' and if so bring up an error message, however I am having a problem with anything containing a space.
Eg. the below works:
if(fullname == "") {
inlineMsg('fullname','You must enter your full name.',2);
return false;
}
But this doesn't:
if(fullname == "full name") {
inlineMsg('fullname','You must enter your full name.',2);
return false;
}
Is there any special syntax for dealing with a space in a string?
Thanks
By the way, this is the JS error I get in Firebug:
targetdiv is null
inlineMsg("fullname", "You must enter your full name.", 2)form_validator.js (line 70)
validate(a.btn)form_validator.js (line 17)
onclick(click clientX=1252, clientY=489)8D1OtsKP...zJw%3D%3D (line 3)
[Break on this error] targetdiv.focus();