We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22895
    • 19 Posts
    All I want is an initial value in the field - so I don’t have to use an external label. Purely for style, but for whatever reason value="" is not working when using eForm. I don’t need dynamic entries, just a simple value in the field, so the user knows what to type in each box.

    Curious, what am I missing here?

    <p> <input type="text" name="email" size="38" maxlength="38" eform="Your Email Address:email:1" value="Enter your email address" /></p>


      • 22895
      • 19 Posts
      Any help here?
      Seems like it should be simple. huh
        • 36416
        • 589 Posts
        Quote from: pbm at Feb 20, 2009, 06:29 AM

        All I want is an initial value in the field - so I don’t have to use an external label. Purely for style, but for whatever reason value="" is not working when using eForm. I don’t need dynamic entries, just a simple value in the field, so the user knows what to type in each box.

        Form template:
        <input ... value="[+fieldname_default+]" />


        efOnBeforeParseEvent:
        global $modx;
         $postback = (count($_POST)>0 && $fields['formid'] == $modx->event->params['formid']) ? true : false;
         if (!$postback) {
          $fields['fieldname_default'] = "fieldname default value";
         }
        
          • 30223
          • 1,010 Posts
          Check what version of eForm you are using and download the latest version if needed. Default values should be honoured by eForm.
            • 22895
            • 19 Posts
            I do have 1.4.4.5 installed.

            Eol. I’ll give your suggestion a try, where would the code "global $modx...." go exactly?

            I attempted to put the code into eform.inc.php - yet still no initial values will appear in the text fields. *shakes head*

            Thanks for the help so far, but I’m still totally lost on how something this simple is so difficult.

            ? eform.inc.php
            global $modx;
             $postback = (count($_POST)>0 && $fields['formid'] == $modx->event->params['formid']) ? true : false;
             if (!$postback) {
              $fields['name'] = "Please enter your full name";
             }
            


            ? In my chunk
                <div class="medium">
                <p> <input type="text" name="name" value="[+fieldname_default+]" size="34"  eform="Your Name::1:Expected at least two words:#REGEX /^\w+\s\w+/i" /></p>
                </div>



            Net HTML result:
            <form method="post" action="index.php?id=7">
                <input type="hidden" name="formid"  value="contactform" />
                
                <div class="medium">
                <p> <input type="text" name="name" size="34"  value="" /></p>
                </div>
            
                <div class="medium">
                <p> <input type="text" name="email" size="34"  value="" /></p>
                </div>
            
                <div class="medium">    
                <p><input type="text" name="department" size="34"  value="" /></p>
                </div>
                
                <div id="message"">
                <p><textarea cols="74" rows="11" name="comments" ></textarea></p>


              • 30223
              • 1,010 Posts
              As I said... upgrade to the latest version should help, 1.4.4.6 was released specifically to address your problem (and some others)

              # eForm now retains default values for check boxes and radio buttons
              # text input fields now retain default value set in form template
              # ...
              http://modxcms.com/eForm-1003.html

              p.s. The version numbering of the files was stupidly not updated correctly in this version so don’t be fooled by that
                • 22895
                • 19 Posts
                Hey thanks! I’ll go get the lastest rev. and see if that does the trick!
                  • 22895
                  • 19 Posts
                  Thanks everyone!
                  It was indeed a version problem. 1.4.4.6 is now installed and appears to have solved the issue.