• Resolved asaaheim

    (@asaaheim)


    We are loving this plugin, for its simplicity and usability. However, as we’re in the process of now fetching form data to process in our marketing automation system, we really need to be able to set an ID on our different forms.

    For testing purposes, we’ve modified the plugin file class-form.php, but this is not viable as we, of course, wish to ensure we can update the plugin to get our latest and always recent pathces/fixes and enhancements.

    Is there somewhere in the plugin we can set this, or is this an option which could be included in a future (not too far away) update? Alternatively, somehow, make sure the set slug for the form is inserted into the generated form code as “id=[slug]”? The currently generated code has a data-id, but not any id inserted in the generated/parsed code, as far as we can see.

    Thanks again, for an amazing plugin!

    • This topic was modified 5 months, 1 week ago by asaaheim.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Link Software LLC

    (@linksoftware)

    @asaaheim There are a few ways you could handle this.

    There isn’t a specific filter hook for modifying the ID of the <form> element, but you could use the generic hf_form_html filter.

    Here’s an example:

    add_filter(
    'hf_form_html',
    function( $html ) {
    $html = str_replace( '<form ', '<form id="my-id" ', $html );
    return $html;
    }
    );

    There is a hf_form_element_class_attr filter hook for adding a CSS class to the form. You might find that useful and easier to use if your marketing system can handle class identifiers.

    Here’s an example:

    add_filter(
    'hf_form_element_class_attr',
    function( $class_attr ) {
    return $class_attr . ' my-class';
    }
    );

    You can learn more about the filter hooks in HTML Forms from the knowledge base. I’m hoping to update that page to be more informative soon.

    Thread Starter asaaheim

    (@asaaheim)

    Thank you for your swift reply. Your info inspired us to look into whether the MS Customer Insights javascript would accept taking the .class rather than the #id, and of course you were right. This also made our final solution even more flexible, so thank you for that ??

    This leaves us with customizations only on in our theme’s .twig-files, and the plugin can live happily with any new updates that would be pushed.

    Happy plugin, happy WP!

    Thank you – and keep up the good work. Will set this to resolved.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.