We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12379
    • 460 Posts
    I’ve labelled my eform inputs using default input text values:

    ie:
      <form id="contact-form" method="post" action="[~[*id*]~]">
       <fieldset>
        <input type="hidden" name="formid" value="contactForm" />
        <p class="text"><input name="name" id="name" type="text" eform="name:string:1:" onclick="clickclear(this,'Name')" onblur="clickrecall(this,'Name')" value="Name" /><span class="reqd">*</span></p>
        <p class="text"><input name="email" id="email" type="text" eform="email address:email:1" onclick="clickclear(this,'Email')" onblur="clickrecall(this,'Email')" value="Email" /><span  class="reqd">*</span></p>
        <p class="text"><input name="subject" id="subject" type="text" eform="subject::1" onclick="clickclear(this,'Subject')" onblur="clickrecall(this,'Subject')" value="Subject" /><span class="reqd">*</span></p>
    etc
    etc


    I need to ignore the words "Name", "Email" and "Subject" in the validation rules as currently these fields aren’t validating (and email is validating as an incorrect email address).
      Mostly harmless.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Try moving the eform attribute to the end. It looks like it’s not properly respecting the end " of its attribute and thinks the rest of the tag is its validation rule.

      Or having all of the delimiters for the last empty fields in the attribute might do the trick:
      eform="eform="name::1::"
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 12379
        • 460 Posts
        No difference. I’m thinking extended validation using #FUNCTION returning true or false if any of the words match...
          Mostly harmless.
          • 12379
          • 460 Posts
          Closest I get is calling this function before the eform snippet call:


          [!eFormFunctions!]
          <?php
          function filterWords($word) {
          
          	$words = array();
          	$words = array('Name','Subject','Email','Message');
          	foreach ( $words as $value )
          		{
          		if ( $word == $value )
            		{ return false; }
            		}
            	return true;	
          }
          ?>


          ..and making the eform template:
             [+validationmessage+]
            <form id="contact-form" method="post" action="[~[*id*]~]">
             <fieldset>
              <input type="hidden" name="formid" value="contactForm" />
              <p class="text"><input name="name" id="name" type="text" onclick="clickclear(this,'Name')" onblur="clickrecall(this,'Name')" value="Name" eform="Name:string:1:missing:#FUNCTION filterWords"/><span class="reqd">*</span></p>
              
              <p class="text"><input name="email" id="email" type="text" onclick="clickclear(this,'Email')" onblur="clickrecall(this,'Email')" value="Email" eform="Email:email:1:missing:#FUNCTION filterWords"/><span  class="reqd">*</span></p>
              
              <p class="text"><input name="subject" id="subject" type="text" onclick="clickclear(this,'Subject')" onblur="clickrecall(this,'Subject')" value="Subject" eform="Subject:string:1:missing:#FUNCTION filterWords"/><span class="reqd">*</span></p>
              
              <p class="message"><textarea name="message" id="message" onclick="clickclear(this,'Message')" onblur="clickrecall(this,'Message')" eform="Message:string:1:missing:#FUNCTION filterWords">Message</textarea></p>
              
            <p class="veribox"><input name="vericode" id="vericode" value="Enter code on right" type="text" onclick="clickclear(this,'Enter code on right')" onblur="clickrecall(this,'Enter code on right')" /> <img class="verimage" src="[+verimageurl+]" alt="Verification code"/></p>
            
              <div class="send"><input type="submit" name="submit" class="button" value="Send message" /></div>
              <p><span class="reqd">*</span>Required</p>
             </fieldset>
            </form>


          Only problem is I’m not getting the form validating for a correct email address format.

          Not sure the above is the most elegant solution, being the php hack that I am.
            Mostly harmless.
            • 17412
            • 270 Posts
            Found the same issue with eForm when using onfocus / onblur etc

            This is a nice solution: Use the form labels as text field values: http://cssglobe.com/post/2494/using-form-labels-as-text-field-values-free-script