We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1343 ☆ A M B ☆
    • 2,213 Posts
    Hey,

    I’m working on a new site and having a problem getting eform to work properly. I found that it’s rewriting the form template which is presenting problems. I’ve been over the code a few times and had another person double check things. I’ve even upgraded to 1.4.4.6 granted the snippet code still shows 1.4.4.5 so I am guessing the change was in the folder?

    [!eForm? &formid=`sidecontact` &subject=`Website Submission` &to=`myemail` &ccsender=`1` &tpl=`sidecontact` &report=`contact_email` &gotoid=`1` !]

    sidecontact chunk:

    <p style="color: red; font-weight: bold;">[+validationmessage+]</p>
    <form method="post" action="[~[*id*]~]" id="sidecontact" name="sidecontact">
    <fieldset>
    	<input type="hidden" value="[*id*]" />
    	<input type="hidden" name="formid"  value="sidecontact" />
    	<input type="text" class="txt" id="name" value="Name" eform="Your Name::1:" />
    	<input type="text" class="txt" id="email" value="Email Address" eform="Email Address:email:1" />
    	<input type="text" class="txt" id="phone" value="Phone Number" eform="Your Phone Number::0:" />
    	<textarea class="txt text_area" id="comments" rows="10" cols="10" eform="Message:textarea:1"></textarea><br />
    	<span class="right"><input type="image" value="" src="[(base_url)]assets/templates/default/images/send.png" class="txt" /></span>
    </fieldset></form>
    


    The output:

    <p style="color: red; font-weight: bold;"></p>
    <form method="post" action="index.php?id=1" id="sidecontact" name="sidecontact">
    <fieldset>
    	<input type="hidden" class="txt" value="1" />
    	<input type="hidden" name="formid"  value="sidecontact" />
    	<input type="text" class="txt" id="name" value="" />
    	<input type="text" class="txt" id="email" value="" />
    	<input type="text" class="txt" id="phone" value="" />
    	<textarea class="txt text_area" id="comments" rows="10" cols="10" ></textarea><br />
    	<span class="right"><input type="image" src="/kitroser/assets/templates/default/images/send.png" class="txt" value="" /></span>
    </fieldset></form>
    


    There are a few problems the first of which being the values are removed from all the fields. If I was to remove the class call from the submit button (the image type last line) it would change every line to a class of txt text_area. The code above was modified so it would display right (doing browser testing) so the classes are a touch off...

    Anyways, could someone tell me why the values are being blanked and why the classes are being rewritten to whatever is the last defined class?

    Oh, this is the original "correct" form, but edge was being replaced by right..

    <form action="#" method="post">
    	<input type="hidden" value="[*id*]" />
    	<input type="text" class="edge" value="Name" />
    	<input type="text" class="edge" value="Email Address" />
    	<input type="text" class="edge" value="Phone Number" />
    	<textarea class="edge"></textarea><br />
    	<input type="image" value="" src="images/send.png" class="right" />
    </form>
    


    Thanks,
    AMDbuilder
      Patrick | Server Wrangler
      About Me: Website | Tweets |  MODX Hosting
      • 30223
      • 1,010 Posts
      None of the fields have a name attribute. Without a name attribute eForm will not work properly (and nor will your form).
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        In a form, it’s the name attribute that gets used in the POST. Without one, there’s no POST.
          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
          • 1343 ☆ A M B ☆
          • 2,213 Posts
          Ah, I knew it had to be something simple I was overlooking!

          I added the name fields and the form is more or less working now, but it’s giving me a tampering error...

          Some errors were detected in your form:
          [undefined] » Tampering attempt detected!

          [!eForm? &formid=`sidecontact` &subject=`Website Submission` &to=`email` &ccsender=`1` &tpl=`sidecontact` &report=`sidecontact_report` &gotoid=`1` !]

          <p style="color: red; font-weight: bold;">[+validationmessage+]</p>
          <form method="post" action="[~[*id*]~]" id="sidecontact">
          <fieldset>
          						<input type="hidden" name="location" value="[*id*]" />
          						<input type="text" class="txt" name="name" id="name" value="Name" onfocus="this.value=(this.value=='Name')? '' : this.value ;" onblur="if (this.value == '') { this.value='Name'; }" eform="Your Name::1:" />
          						<input type="text" class="txt" name="email" id="email" value="Email Address" onfocus="this.value=(this.value=='Email Address')? '' : this.value ;" onblur="if (this.value == '') { this.value='Email Address'; }"  eform="Email Address:email:1" />
          						<input type="text" class="txt" name="phone" id="phone" value="Phone Number" onfocus="this.value=(this.value=='Phone Number')? '' : this.value ;" onblur="if (this.value == '') { this.value='Phone Number'; }" eform="Your Phone Number::0:" />
          						<textarea class="txt text_area" name="comments" id="comments" rows="10" cols="10" eform="Message:textarea:1"></textarea><br />
          						<span class="right"><input type="image" value="" src="[(base_url)]assets/templates/default/images/send.png" class="txt" /></span>
          </fieldset>
          </form>
          


          The visitor named [+name+] sent you the following information from the [+location+] page.
          Name: [+name+]
          Email: [+email+]
          Phone: [+phone+]
          Comments: [+comments+]
          


          Any ideas on this one?

          Thanks,
          AMDbuilder
            Patrick | Server Wrangler
            About Me: Website | Tweets |  MODX Hosting
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            eForm doesn’t like variables in hidden input fields. I believe there have been other discussions on this. http://modxcms.com/forums/index.php?topic=28421.0
              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
              • 1343 ☆ A M B ☆
              • 2,213 Posts
              eForm faith restored! Long live MODx!

              It’s all working perfectly now thanks for all the help. grin
                Patrick | Server Wrangler
                About Me: Website | Tweets |  MODX Hosting