Is there a way to apply fade effect after validation. For example the user leave a textfield blank, then I’ll return a text saying “All Fields Are Required!”.
Currently I have this:
.successbox, .warningbox, .errormsgbox {
font-weight:bold;
border: 2px solid;
margin: 10px 0px;
padding:15px 10px 15px 70px;
background-repeat: no-repeat;
background-position: 10px center;
width:600px;
}
.errormsgbox {
color: #D8000C;
background-color:#FDD5CE;
background-image: url('../images/error.png');
}
I’m returning the error like this:
<?php if($error) : ?>
<div class="errormsgbox" ><?php echo $error ?></div>
<?php endif ?>
And my js up to now is just like:
$(".errormsgbox").fadeOut("slow");
I always check for blank fields, poorly formatted emails, etc. with JS and jQuery. I tend to do a lot of ajax, so I also do a lot of callback handling along these lines. Here’s an example of handling errors for an ajax form:
Here’s an example of some markup:
Some css: