We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23802
    • 65 Posts
    few questions

    1.
    how to i have validation for each input for it’s own not just one <p> containing all errors?
    like
    <label>becomes red on validation fail
    <input>
    <span>error message + turn visible after validation fail


    <input name="email" id="cfEmail" class="text" type="text" eform="Email Address:email:1" />

    as i see on eform parameter i can enter
    [name which i have no idea what for and where it used] : [validations type, which is clear to me] : [validations on or off] : [custom validations message i want to appear at <span> as above]

    2.
    at "ContactFormReport" chunk the values at [+?+] ie. [+subject+] are taken from input’s name parameter?

    also is there any connection between the way i receive the massage from my site by email and this form? if not is there a way i can customize the way i receive a message

    3.
    [!eForm? &formid=`ContactForm` &subject=`[+subject+]` &to=`[(email_sender)]` &ccsender=`1` &tpl=`ContactForm` &report=`ContactFormReport` &gotoid=`46` !]

    &to=`` set to [(email_sender)] which means...? i’ve seen ppl changing it to their own email should i do the same?



    thanks in advance
      • 24414
      • 45 Posts
      ow to i have validation for each input for it’s own not just one <p> containing all errors?
      like
      <label>becomes red on validation fail
      <input>
      <span>error message + turn visible after validation fail

      eForm outputs required fields with a class of required if they aren’t filled in - so changing their appearance isn’t too hard with CSS.
      The way that error messages are controlled is using the language files that come with the snippet, these can easily be edited to give custom error messages. Error messages are outputted where the [+validationmessage+] placeholder is in the form template so in it’s deault state I don’t think that eForm can create inline error messages.

      <input name="email" id="cfEmail" class="text" type="text" eform="Email Address:email:1" />

      as i see on eform parameter i can enter
      [name which i have no idea what for and where it used] : [validations type, which is clear to me] : [validations on or off] : [custom validations message i want to appear at <span> as above]

      The name parameter is used in the error message placeholders. i.e. Email Address is a required field.
      To create completely custom validation message in the parameters here you will have to also use the ’Extended Server Validation’ features.
      A lot can also be edited using the language files found @ /assets/snippets/eform/lang/ (I had to do a little editing of eform.inc.php to get things exactly as I wanted).

      at "ContactFormReport" chunk the values at [+?+] ie. [+subject+] are taken from input’s name parameter?

      also is there any connection between the way i receive the massage from my site by email and this form? if not is there a way i can customize the way i receive a message

      Yup you’re right about the placeholders being input names. Unsure exactly what you mean by customising your message though.

      &to=`` set to [(email_sender)] which means...? i’ve seen ppl changing it to their own email should i do the same?

      [(email_sender)] is a placeholder for the the default email as set in the site configuration. Set it to whatever you want if you don’t want to use the site default email.

        • 23802
        • 65 Posts
        ram, thanks

        1.
        still needs an answer about inline error messages, it must a way. TobyL is too eFormed to miss that functionality.

        2.
        i meant to customize email would be sent but silly me.
        default "ContactFormReport" is the way i receive an email ...

        3. so [(email_sender)] default email i set via manager>tools>configuration>User or during MODx installation as admin email?
          • 24414
          • 45 Posts
          still needs an answer about inline error messages, it must a way. TobyL is too eFormed to miss that functionality.

          I would like similar functionality myself, but I haven’t found any way that it’s possible to do so so far. JavaScript trickery maybe?

          i meant to customize email would be sent but silly me.
          default "ContactFormReport" is the way i receive an email ...

          You can create your own template to create the email in any way you want with the available placeholders.

          so [(email_sender)] default email i set via manager>tools>configuration>User or during MODx installation as admin email?

          I think this is the same address in manager>tools>configuration, not sure about email set initialy.
            • 30223
            • 1,010 Posts
            still needs an answer about inline error messages, it must a way. TobyL is too eFormed to miss that functionality.
            Thanks for the compliment smiley but no there is no inbuilt functionality for individual error messages. In most cases this is not needed and it’s impossible to cater for every need and circumstance. For the required messages you could use the eFormOnValidate event and write your own solution, but this is much more difficult for other validation messages as these messages are not stored with a reference to the input field.

            I don’t see a lot of use for this but I will keep it in mind for a next version...




              • 23802
              • 65 Posts
              TobyL, i come from accessibility point of web. when there are inputs and there is an error the incorrect input should be highlighted whether it’s a red star near by, border of input becomes red or label text it doesn’t matter but input should be incorrect highlighted.

              hopefully you will implement that in next version like having boolean eform parameter whether to highlight or not, could be even better to trigger input, label of input or span near input out of user’s choice.
                • 6926
                • 41 Posts
                For inline error messages, you can try using Javascript stuff. I have not tried it with modx but I am sure it can be done as you just have to include couple of JS files in the head and add some JS code along with the form.

                Checkout the code here: http://tetlaw.id.au/view/javascript/really-easy-field-validation

                Demo can be checked here: http://tetlaw.id.au/upload/dev/validation/

                I hope this is what you wanted to do.

                Regards,
                Deep
                  Deep Ganatra
                  Web1 Solutions
                  • 23802
                  • 65 Posts
                  cool validation, i think it would be better to implement it rather having validation checks though php. especially when prototype included within modx as far as i know.

                  just to be sure do i need to set form’s action to
                  action="[~[*id*]~]"
                  if the validation passes via Javascript?

                  lol, i’m messed up, late hours for me i must be asking stupid questions
                  cheers


                  anyway

                  this is my form structure

                  <form method="post" action="[~[*id*]~]" id="EmailForm" name="EmailForm">
                  <fieldset>
                      <input name="formid" type="hidden" value="ContactForm" />
                      <h5 class="formError">[+validationmessage+]</h5>
                  
                  	<label for="cfCompanyname">Company Name :</label>
                      <input name="company" id="cfCompanyname" type="text" eform="Company Name::1" /><br />
                      
                      <label for="cfYourname">Your Name :</label>
                      <input name="name" id="cfYourname" type="text" eform="Your Name::1" /><br />
                      
                      <label for="cfYoursite">Your Website Address :</label>
                      <input name="site" id="cfYoursite" type="text" eform="Your Website::1" /><br />
                          
                      <label for="cfEmail">Your Email Address :</label>
                      <input name="email" id="cfEmail" type="text" eform="Email Address:email:1" /><br />
                      
                      <label for="cfRegarding">Your Request :</label>
                      <select name="subject" id="cfRegarding" eform="Your Request::1">
                          <option value="x">x</option>
                          <option value="y">y</option>
                          <option value="z">z</option>
                          <option value="v">v</option>
                          <option value="other">other</option>
                      </select><br />
                  
                      <label for="cfMessage">Additional Information :</label>
                      <textarea name="message" id="cfMessage" rows="10" cols="20" eform="Additional Information:textarea:1"></textarea><br />
                  	
                      <label></label>
                      <input type="submit" name="contact" id="cfContact" value="send it to us" />
                      
                  </fieldset>
                  </form>


                  and this is my report structure
                  <p>This is a response sent by <b>[+name+]</b></p>
                  
                  <p>Company Name:<br />[+company+]</p>
                  <p>Name:<br />[+name+]</p>
                  <p>Website:<br />[+site+]</p>
                  <p>Email:<br />[+email+]</p>
                  <p>Request :<br />[+subject+]</p>
                  <p>Additional Information :<br />[+message+]</p>



                  in email i received i’ve got no [+company+] [+name+] [+site+] so whats wrong in here?
                    • 6926
                    • 41 Posts
                    Quote from: pr0ph3t at May 29, 2007, 05:21 PM

                    cool validation, i think it would be better to implement it rather having validation checks though php. especially when prototype included within modx as far as i know.

                    just to be sure do i need to set form’s action to
                    action="[~[*id*]~]"
                    if the validation passes via Javascript?

                    Yea keep action as same because after JS validation it will cross check the data again and process it (i.e. send it to the specified email address)

                    The validation via PHP is also needed coz it will help if someone is accessing the form with Javascript disabled.

                    Regards,
                    Deep
                      Deep Ganatra
                      Web1 Solutions
                      • 30223
                      • 1,010 Posts
                      Quote from: pr0ph3t at May 29, 2007, 01:06 PM

                      TobyL, i come from accessibility point of web. when there are inputs and there is an error the incorrect input should be highlighted whether it’s a red star near by, border of input becomes red or label text it doesn’t matter but input should be incorrect highlighted.

                      hopefully you will implement that in next version like having boolean eform parameter whether to highlight or not, could be even better to trigger input, label of input or span near input out of user’s choice.

                      There is already the possibility to highlight any inputs with errors (and their labels) with css. Have a look at the eForm documentation for &requiredClass and &invalidClass parameters.