3

I'm creating a Notification Template with this tag pair:

{all_form_fields}
    {field_label}
    {field_data}
{/all_form_fields}

But the order's ending up alphabetical, not in the order I put them in Composer.

After finding http://www.solspace.com/forums/viewthread/15678 then seeing that this appeared to be fixed at http://www.solspace.com/docs/freeform/change_log/#v4.0.11:

Fixed a bug where Notification templates using the '{all_form_fields}' variable pair were not ordering data by the field order set in the form edit screen in the CP and were going in Alphabetical order instead.

I'm not sure what to do. Anyone have any ideas?

  • 1
    What version of Freeform and EE are you using? Are you using the Freeform Composer? That changelog item was for forms using template forms, i.e. {exp:freeform:form}. – Solspace Jun 13 '14 at 18:58
  • Using EE 2.7.3 and FF 4.1.7. Yes, using Composer. Using a Notification Template from a Composer form, is there any way to output the fields in the order they are in Composer? That is, apart from making a new Notification Template for each form with manually-added fields. – jphansen Jun 16 '14 at 14:35
  • 1
    Unfortunately this ordering isn't available for Composer forms. Manually adding fields in a notification template, as you mentioned, is the way to go at this time. I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. support.solspace.com/support/discussions – Solspace Jun 17 '14 at 3:05
  • I've received the same question from one of our clients. Has this been addressed yet? Thank you. – Diederik Oct 14 '15 at 12:06
0

I ended up making so many custom notifications for long forms, I wrote this script to make it easy. You can run this and put the lines in the correct order.

<?
$sql = "SELECT `COLUMN_NAME` 
    FROM `INFORMATION_SCHEMA`.`COLUMNS` 
    WHERE `TABLE_SCHEMA`='ee_facs' 
    AND `TABLE_NAME`='exp_freeform_form_entries_65';";
$result = mysql_query($sql);
for ($i = 0; $i < mysql_num_rows($result); $i++) {
    $column_name = mysql_result($result, $i, "COLUMN_NAME");
    if (strpos($column_name, "form_field") !== false) {
        // look up form field's label + name
        $field_id = trim($column_name, "form_field_");
        $sql = "SELECT field_name, field_label FROM exp_freeform_fields WHERE field_id = $field_id";
        $field_result = mysql_query($sql);
        $field_name = mysql_result($field_result, 0, "field_name");
        $field_label = mysql_result($field_result, 0, "field_label");
        echo "&lt;p&gt;" . $field_label . ": {" . $field_name . "}&lt;/p&gt; <br>";
    }
} //for
?>

This outputs like:

<p>First Name: {first_name}</p> 
<p>Last Name: {last_name}</p>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.