We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44922
    • 131 Posts
    Hi, I'd like to ask if anyone has experience with FormItLog - particularly with regard to extending the fields provided in the FormItLog page?

    It seems to do a nice job of compiling a report via a custom manger page of any email forms sent, provided the form is limited to name, email and message fields. Clearly, may forms will differ from those standard three fields. I can't find any documentation on this extra except the very scant ReadMe on github.

    I'm about to try hacking around the FormItLog code in core/components, but my php skill are not the most advanced and I'm not too sure which file gets the form fields to create the logfile.

    It occurred to me to create a custom FormIt hook which created new palceholders from combonations of my Forms fields which would all be funnelled into the single "text" message field within the FormITLog hook - but it's a big form and that will look rather unwieldy.

    Thanks
      • 44922
      • 131 Posts
      As no-one could help with this, I created a simple snippet which just combined my FormIt form fields into the "name" "text" "subject" and "email" fields used (email was already used in my form, so that was fine). That way, the custom manager page which comes with FormItLog can be used with no code hacking or messing about. This is a good quick fix if your client needs a simple log of forms submitted, and you are using FormIt but with different fields to "name" "text" "subject" and "email".

      So for example, my FormIt form needed "fname" and "lname" as separate values to send to the client, but FormItLog is just looking for a "name" field. Multiple fields also combined for the other fields included with the FormIt log. It's then called as a FormIt custom Hook beform the FormItLog custom hook:

      <?php
      $formFields = $hook->getValues();
      $name = $formFields['fname'] . ' ' . $formFields['lname'];
      $text = ' Message:' . $formFields['details'] . 'Time Spent:' . $formFields['total_length'];
      $subject = 'Landline:' . $formFields['landline'] . ' Mobile:' . $formFields['mobile'];
      $hook->setValue('name', $name);
      $hook->setValue('text', $text);
      $hook->setValue('subject', $subject);

      return true;