one issue to add :) I want the message text in the div inputbottom-text, but also on error update or replace the inputrightdiv with inputrightdiv-valid , as this class has my green tick. Is it possible to alter a div class on error, but place error text into another div?
thanks again for any help. On Dec 23, 6:34 pm, "p...@scotche.gg" <p...@scotche.gg> wrote: > Hi Guys > > I am trying to get validate to work, but I am soo close and yet soo > far! > I think the problem is the selector and way i append the error or > valid classes to the label, or specify the element for errors? > > Can anyone see the mismatch or problem? > > HTML example... > [code]<div class="namediv">Company Name:</div> > <div class="textdiv"> > <div class="inputdiv"><input > name="CompanyName" id="CompanyName" > type="text" class="input-text"/ value="<?if(isset($this->company_name)){ > echo $this->company_name;};?>"></div> > > <div class="inputrightdiv" > id="img_CompanyName"></div> > </div> > <div class="inputbottom-text" > id="error_CompanyName"><?php echo > $this->error_array['company_name']; ?></div> > [/code] > > where the inputrightdiv is what holds my todo image, > then i want it replaced with inputrightdiv-valid which shows my nice > green tick image! > > Jquery Validation initialization( i have taken out extra options for > simplicity )... > > [code] > <script> > $(document).ready(function() { > // validate signup form on keyup and submit > var validator = $("#recruiter_signup").validate({ > rules: { > CompanyName: "required" > > }, > messages: { > CompanyName: "Please ensure you have entered your > company name." > > }, > // the errorPlacement has to take the table layout into > account > errorPlacement: function(error, element) { > error.appendTo(element.parent().parent()); > > }, > // Set Error Element > errorElement: "div.inputrightdiv", > // Focus in textbox > focusInvalid: false, // show all form error at a time > // Set Error Class > //errorClass: "error", > errorClass:"inputrightdiv-error", > // specifying a submitHandler prevents the default submit, > good for > the demo > submitHandler: function() { > alert("submitted!"); > }, > // set this class to error-labels to indicate valid fields > success: function(label) { > > label.addClass('inputrightdiv-valid'); > > } > });}); > > </script>[/code] > > thanks for any tips or eagle eyes :)