staypuffinpc
08-13-2009, 06:08 PM
I have created a simple login form and am working on validation. Currently, I just check to make sure there is actually something filled out in the name field and, if not, when the user clicks the "submit" button, a div appears underneath the input indicating that the user needs to fill out their name.
$('form').submit(function(){
if ( $('#userName').val() == '') { $("<div class='error'>please provide your user name to continue</div>").insertAfter('#userName');}
});
when I submit the form, this works fine, but then the page quickly refreshes and it goes away. Does anyone know what's going on?
You can see a sample at http://peter.byuipt.net/sites/rewardSystem/
$('form').submit(function(){
if ( $('#userName').val() == '') { $("<div class='error'>please provide your user name to continue</div>").insertAfter('#userName');}
});
when I submit the form, this works fine, but then the page quickly refreshes and it goes away. Does anyone know what's going on?
You can see a sample at http://peter.byuipt.net/sites/rewardSystem/