Hi all, Having tried a few validation plugins, none can do exactly what I want (given the time I have to spend on it), so I'm doing it the manual way, but I can't figure out how to turn my repititions into a function. I have this; //validation for forms $('#admin-quotes').submit( function(){ var inputcheck = $("#person"); // if field has something in it, do submit actions, otherwise write out error if( inputcheck.val() == '' ){ // add class to change colour inputcheck.addClass("required").get(0).focus(); return false; }else{ inputcheck.removeClass("required"); } var inputcheck = $("#position"); // if field has something in it, do submit actions, otherwise write out error if( inputcheck.val() == '' ){ // add class to change colour inputcheck.addClass("required").get(0).focus(); return false; }else{ inputcheck.removeClass("required"); } }); and obviously it's ripe for a function like; function simplecheck(fieldid){ var inputcheck = $(fieldid); // if field has something in it, do submit actions, otherwise write out error if( inputcheck.val() == '' ){ // add class to change colour inputcheck.addClass("required").get(0).focus(); return false; }else{ inputcheck.removeClass("required"); } } But I can't get the right combinations of return true/false and calling the fuction to work whereby the form does the same with a function as it does with the 'manual' checking. Can anyone forge it into something that works? TIA! Luc Pestille Web Designer
In2 Thames House Mere Park Dedmere Road Marlow Bucks SL7 1PB Tel 01628 899700 Fax 01628 899701 e: [EMAIL PROTECTED] i: www.in2.co.uk This message (and any associated files) is intended only for the use of jquery-en@googlegroups.com and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not jquery-en@googlegroups.com you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored. Any views or opinions presented are solely those of the author [EMAIL PROTECTED] and do not necessarily represent those of the company.
<<inline: jointbrand_emailsigs_I.gif>>