Note that there are some explanatory texts on larger screens.

plurals
  1. POCan you validate fieldsets individually using the jquery validation plugin from bassassistance?
    primarykey
    data
    text
    <p>I have a form that uses the validation plugin, but I need to validate a separate part of the form using slightly different criteria - most of the fields place the error in the next table cell, but for one field I need the error placed somewhere else.</p> <p>This is the validate function for the main form fields:</p> <pre><code>jQuery("#form2").validate({ rules: { street: { required: true, minlength: 5 }, city: { required: true, minlength: 3 }, state: { required: true }, zip: { required: true, minlength: 5 } }, messages: { street: { required: "Please enter your address", minlength: "Address is too short" }, city: { required: "Please enter your town/city", minlength: "Town/City is too short" }, state: { required: "Please enter your county" }, zip: { required: "Please enter your postcode", minlength: "Postcode is too short" } }, errorPlacement: function(error, element) { error.appendTo(element.parent("td").next("td")); } }); // end validate </code></pre> <p>Basically I would also like to validate this fieldset separately, so a different value can be used for errorPlacement:</p> <pre><code> jQuery("#elecfields").validate({ rules: { sup1: { minlength: 2 } }, messages: { sup1: { minlength: "must be 2 digits" } }, errorPlacement: function(error, element) { // different error placement is needed here } }); // end elecfields validate </code></pre> <p>elecfields is a fieldset inside form2 - but this doesn't seem to work.</p> <p>It seems that the errorPlacement must apply to all fields in the form, but I just have that one field that needs the error places somewhere else. Any ideas for how this can be achieved? Any help is very much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload