We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30223
    • 1,010 Posts
    Quote from: runningthingz at Jan 06, 2007, 04:51 PM

    When I submit my form I get the email with the correct Subject but there is nothing in the email.

    Here is what I got:

    [!eForm? &formid=`SubmitForm` &to=`[email protected]` &tpl=`SubmitForm` &category=`Contact Requests` &format=`name:Name:string:1,email:Email:email:1,message:Message:html:1`!]
    

    First of all,... what version of eForm are you using? If it’s a recent one then remove the &format parameter from your snippet call. It has been deprecated.

    And as sirlancelot already indicated you will need a report chunk to create the body of the email.

    Quote from: identity at Jan 06, 2007, 09:10 PM

    Apologies if I’ve missed the answer elsewhere, but this is the first time I’ve tried to implement eForm using a dropdown menu for subject and sending to more than one email address....

    I’m using a dropdown for subject that also determines the recipient email. Sending to one email was fine and I could plug in the subject into the email, but when allowing sending to different emails, it seems that the dropdown values must be set to 1, 2, 3, n instead of a subject value to determine the appropriate email address.

    This works fine for determining the email to send to but now the subject is listed as 1, 2, n.

    Is there a way to use one dropdown to select the subject and recipient, route to that email address, and allow that subject line to show up in the email?

    Not directly but you could use the eFormOnBeforeMailSent event to achieve something like this. Call your combobox "selectSubject" instead of "subject", set &mailselector=`selectSubject` which will handle the recipient part and use a function like this to handle the subject:
    <?php
    //event function
    function onBeforeMailSentFunction( &$fields ){
        //array of subjects
        $subjectArray = array(
             "Subject 1",
             "Subject 2",
             "Subject 3",
             "Subject 4"
         );
    
        //get value of selectSubject
        $i = (int)$fields['selectSubject'];
        if ($i>0) $i--;
        $fields['subject'] = ( isset($subjectArray[$i]))?$subjectArray[$i]:$subjectArray[0];
        
        return true;
    }
    ?>
    


    Have a look through eForm’s documentation on how to make this function available to the event....
      • 25737
      • 62 Posts
      Thanks for the help guys the form works great now! smiley
        Faithfully using MODx since 2007!
        • 12652
        • 228 Posts
        TobyL,

        Thanks for the info. I don’t seem to be getting things to work, just getting a blank screen after submit, so I may just have to pass on this for now.
          | Identity Developments delivers SEO focused web design and web presence services
          - it&#39;s not about websites, it&#39;s about your identity. |
          • 23491 ☆ A M B ☆
          • 1,056 Posts
          eform.inc.php Line 78 reads:

          if(count($_POST==0) && !preg_match('/<input[^>]*?name=[\'"]formid[\'"]/i',$tpl)){
          


          ...although I think it should actually be:

          if(count($_POST)==0 && !preg_match('/<input[^>]*?name=[\'"]formid[\'"]/i',$tpl)){
          


          NOTE: changed count($_POST==0) to count($_POST)==0

          Am I way off base with this?
            Mike Reid - www.pixelchutes.com
            MODx Ambassador / Contributor
            [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
            ________________________________
            Where every pixel matters.
            • 30223
            • 1,010 Posts
            Quote from: pixelchutes at Jan 08, 2007, 03:50 PM

            NOTE: changed count($_POST==0) to count($_POST)==0

            Am I way off base with this?

            Oops, my fault.. too quick in correcting a bug and not double checking myself.. Thanks for catching that.. I’ve updated the repository.
              • 27376
              • 576 Posts
              [BUG] Integer Validation.

              I found that when a form contains input that I’ve told eform to validate as integer that is NOT required (eg eform="Number Item:integer:0"), eform still thinks that it IS required. This is not the behavior that I expected, so I did a little code search and found the line:
              <?php // eform.inc.php (Line 183)
              if (!is_numeric($value)) {
                  // not valid...
              } ?>

              This should be changed to:
              <?php if (!is_numeric($value) && $isRequired){ ?>

              Since an empty value equates to NaN, we also check to see if the field is required.

              That’s my two cents, amazing snippet TobyL!

              btw. the line number corresponds to the most recent snippet in the repository.
                • 23491 ☆ A M B ☆
                • 1,056 Posts
                Nice! Glad to help.

                I’m experiencing some weirdness in 1.4.3...

                Using <form id="myform" ... > method, the hidden formid is added on the first load:

                <input type="hidden" name="formid" value="myform"></form>


                If submit a blank form (revealing validation message), the hidden formid is not added, and my NEXT submission is "validation-less" huh

                Let me do some further testing to confirm this...

                @sirlancelot,

                I just noticed this as well! What are your/TobyL’s thoughts on dropping is_numeric for something like:
                !ctype_digit( (string) $value )
                // or
                (int) $value > 0
                
                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 23491 ☆ A M B ☆
                  • 1,056 Posts
                  Quote from: pixelchutes at Jan 08, 2007, 05:04 PM

                  I’m experiencing some weirdness in 1.4.3...

                  Using <form id="myform" ... > method, the hidden formid is added on the first load:

                  <input type="hidden" name="formid" value="myform"></form>


                  If submit a blank form (revealing validation message), the hidden formid is not added, and my NEXT submission is "validation-less" huh

                  Let me do some further testing to confirm this...

                  I have confirmed this to be a valid issue. Funny, as it’s related to:

                  if(count($_POST)==0 
                  


                  ...If the form has already been submitted (hence count($_POST) IS > 0 ), then dynamic addition of hidden formid does not occur...by definition. Is this the anticipated result? I would think not ?

                  Also, what if to get to one form (eForm ’Form B’), I needed to first pass through an initial form (say, a simple, non-eForm ’Form A’) ...

                  Wouldn’t (count($_POST) carry over from ’Form A’ during the loading of eForm ’Form B’, causing my initial form parse to drop the dynamic hidden "formid" insertion?

                  Back to Re: eForm 1.4.3 released (multiple form bug fixes)
                    Mike Reid - www.pixelchutes.com
                    MODx Ambassador / Contributor
                    [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                    ________________________________
                    Where every pixel matters.
                    • 30223
                    • 1,010 Posts
                    Quote from: pixelchutes at Jan 08, 2007, 05:04 PM

                    Nice! Glad to help.
                    If submit a blank form (revealing validation message), the hidden formid is not added, and my NEXT submission is "validation-less" huh
                    You are right! Wrong assumption by me. Replacing line 78 with this should fix it. (leaving out the count($_POST)==0 test)
                    if(!preg_match('/<input[^>]*?name=[\'"]formid[\'"]/i',$tpl)){
                    


                    This should be changed to:
                    Code:

                    <?php if (!is_numeric($value) && $isRequired){ ?>


                    Since an empty value equates to NaN, we also check to see if the field is required.

                    The aim of that line is to validate for correct type even if the field is not required, but you are correct that it needs changing. A simple test for an empty value is all that’s needed I’d think.

                    <?php if (strlen($value)>0 && !is_numeric($value)){ ?>


                    Update
                    Have made these corrections in the repository
                      • 36451
                      • 264 Posts
                      Thank you for maintaining this script, Jelle.

                      Please update line 83 to
                      version => '1.4.3'
                      to avoid confusion when checking the version number smiley

                      This discussion is closed to further replies. Keep calm and carry on.