View Full Version : JS Form Validation Alert Messages
tek420angel
01-24-2005, 12:13 PM
Is there any way to get form validation alerts (I.E. "The first name field must not be left blank.") to appear on the page rather than displaying on the page? And if so, can the font/color properties be edited? An example of this might be done would be very much appreciated. Thanks.
Whiteknight
01-24-2005, 01:58 PM
test the input field with a strlen() function, to determine the length of the input. if the length of the input string is 0, then there is no input, and display the error message. if, however the strlen is != 0, then display no number. this is a simple if/else statement, and possibly a while() loop. can you figure it out from there?
selwonk
12-28-2006, 05:50 PM
Presumably you've already got a routine which does the validation? If so, you could achieve this quite easily by returning the function as false if the validation fails after displaying the error using innerHTML:
<script language="JavaScript">
document.DivName.innerHTML='Error message';
</script>
...
<div id="DivName">
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.