We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2057
    • 12 Posts
    I’m trying to get an eform going, and I’ve run into a problem with <textarea> form fields. It appears that I can only have 1 <textarea> field per form because the parser (maybe?) strips out everything between where the first text area field is declared and the last textarea field is. So in a form with three <textarea> fields in the &tpl chunk, when it is rendered in the browser, only the last field shows up. The other two fields and all other code in between is missing from the source. Remove all but one of the <textarea> fields, and everything else shows up fine.

    I don’t know where to look to workaround this - has anyone else noticed this problem? Here’s my code calling the eform:

    [[eForm? &formid=`TestForm` &to=`[email protected]` &tpl=`eQuestionnaireFormTest`
    &report=`eQuestionnaireReport` &gotoid=`66` &subject=`Product Info Request from Website`]]


    My test form:
    <form action="[~[*id*]~]" method="post">
    	<input type="hidden" name="formid" value="TestForm" />
    			<textarea name="textareaName" rows="4" cols="40" eform="Test 1::0"></textarea>
    <textarea name="textareaName1" rows="4" cols="40"eform="Test 2::0"></textarea>
    <textarea name="textareaName2" rows="4" cols="40" eform="Test 3::0"></textarea>
    <input type="submit" name="submitButtonName" value="Send Product Information Request"/>
    		</form>


    And what renders in the browser:
    <form action="test.html" method="post">
    	<input type="hidden" name="formid" value="TestForm"/>
    			<textarea name="textareaName2" rows="4" cols="40"></textarea>
    <input type="submit" name="submitButtonName" value="Send Product Information Request"/>
    		</form>


    This is a wonderful snippet, and otherwise has worked really well for what I’ve needed.
      • 7923
      • 4,213 Posts
      Just guessing, have you tried to put space in the first textarea tag before eform attribute?


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 2057
        • 12 Posts
        doze - I just tried putting and removing spaces, both before and after the eform attribute, but it didn’t make any difference. It also strips out a default value placed between <textarea etc>text</textarea> - the last one in the form just renders like there was never a value there although it is hard coded in the chunk. Odd, huh?
          • 30223
          • 1,010 Posts
          Quote from: arielmango at Sep 15, 2006, 06:20 PM

          doze - I just tried putting and removing spaces, both before and after the eform attribute, but it didn’t make any difference. It also strips out a default value placed between <textarea etc>text</textarea> - the last one in the form just renders like there was never a value there although it is hard coded in the chunk. Odd, huh?

          No, not odd at all.. I think you’ve just pointed out a bug in eFormParser. I will have a look into it and get back to you. That the text between opening and closing textarea tags disappears is actually by design.. Maybe I need to rethink that as well.
            • 2057
            • 12 Posts
            TobyL - Thank you for looking at it. It took me forever to figure out what was happening to my form. I’m surprised no one else has run into this.
              • 30223
              • 1,010 Posts
              Ok, here’s an updated drop in replacement for eFormParser.inc.php (version 1.01)

              Fixes:
              No longer gobbles up anything when using more then one <textarea> field.
              Now retains default text in <textarea > fields.

              The first problem was simply a regular expression which was a bit too generous. I never tested it with multiple textarea fields. Let me know if you find anything else smiley

              Perhaps a moderator can update the first post with this file?


                • 25663 MODX Staff
                • 12,272 Posts
                Thanks TobyL... I had trouble unzipping the archive (had to resort to an alternate OS X utility) so I thought I’d re-post it here. Committing this very soon to the eForm project in SVN and to the Trunk.
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 2057
                  • 12 Posts
                  Thanks! That worked perfectly and everything shows up as expected!

                  Ariel