We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16085
    • 203 Posts
    Is is possible to have the validation message appear at each errored instance on a form rather then grouped at the top.

    For example iumput field missing data then below each highlighted field it would read ’This field is required’.
      • 16085
      • 203 Posts
      I’ve found a similar post asking for the same thing here. http://modxcms.com/forums/index.php/topic,7521.msg126225.html#msg126225

      I’ve got CSS styling working on the form after putting the class on my input field: class="text requiredValue invalidValue" and &invalidClass=`invalidValue` &requiredClass=`requiredValue` in my eForm call.

      But I still can’t figure out how to get the validation message to appear per input field, bit like the jQuery examples & screen shot above: http://jquery.bassistance.de/validate/demo/

      This is what I’m using on the input: eform="Your Firstname:string:1:Enter you Firstname". I thought validation message ’Enter you Firstname’ would automatically insert itself around that input field.. But all thats happening is the [+validationmessage+] ’Some errors were detected in your form: The following required field(s) are missing: Your Firstname’.

      What am I overlooking... ?
        • 4310
        • 2,310 Posts
        I’m not sure you’re missing anything.
        IIRC Eform does the validation on submit, by evaluating all fields in one pass basis,
        rather than on a field by field as you go along basis.
        Maybe you could use JQuery to do the validation instead of Eform.
          • 16085
          • 203 Posts
          @bunk58, that’s what I thought. Reading the doc’s the [+valid..+] doesn’t state it can do it on a per field basis. Which is what I wanted. I was trying not to use jQuery and rather trying to keep it all eForm native, as I’ve no idea how that would integrate.

          Although I did put the error div beneath each input that required validation, commented out ’ef_validation_message’ and also took out {fields} from ’ef_required_message’ in snippets\eform\lang\english.inc.php. Which kind of works. Doesn’t give me the nice per error that I wanted but it works.

          I was under the impression from the docs,
          [description/title]:[datatype]:[required]:[validation message]:[validation rule], that if I used the format Your Firstname:string:1:Enter your Firstname, Enter your Firstname would be the displaying error and not Your Firstname which is what it does with {fields} left in. But then I got stuck with there being no error/validation call to place beneath each input box.. sad

          Anyway I shall look at using jQuery for the validation.
            • 24495
            • 407 Posts
            But it would be nice to style validation message via template like other snippets’s output. I prefer to have a validation message with a heading and an unordered list of errors. That’s possible only by hacking the eform snippet.