We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10164
    • 27 Posts
    Ok the questions sounds silly, but here goes...
    I am making a monster form with 360+ questions. (dont ask)
    the form has only 8 questions which are required, the rest are optional. i need the form report to only show the questions answered, and the required questions.
    instead of a monster form report emailed through with 360 unanswered questions and a small handfull of answers to find.
    Has anyone had this requirement before ? or come up with a workaround?
    Thanks in advance smiley
      • 30223
      • 1,010 Posts
      You could write your own report function and use the eFormOnBeforeMailSent event. The way to do that would be to create a report template like this:
      <p>Some intro text and the required fields:</p>
      <p>
      Field 1: [+required_field_1+]<br />
      Field 2: [+required_field_2+] (etcetera)
      </p>
      <p> All other report fields to be placed in this placeholder:</p>
      <p>[+report_fields+]</p>
      


      Now write yourself a function where you go through all the field values and create the report on the go:

      <?php
      function my_own_report_function(&$fields){
         /* NOTE! This is not real working code!
         It's just to give you a hint of how you can approach this. */
         foreach($fields as $fld => $value){
            if(!empty($value) && field_is_not_required($fld)){
               $report_value .="<p>{$fld}: {$value}</p>";   
            }
         }
         //place the result back into the $fields array
         $fields['report_fields'] = $results;
         
         //return succes.
         return true; //important
            
      }
      ?>


      Hopefully your code will be a bit more sophisticated than this smiley

      Read the eForm documentation on how to add the function and the event to the eform snippet call.
      Good luck
        • 21671
        • 244 Posts
        Hi There,

        Did you come up with a solution for your monster form? I am having the same problem and am pulling what is left of my hair out. If you are willing to share the code I would be waaaaaay appreciative.

        Noah
          • 19975
          • 429 Posts
          has anyone found a suitable solution, ideally we could use PHX?
            Martin Sanders - Design & Web Development