• Resolved devpii

    (@devpii)


    Hi,

    I would like to use the filter hook [fluentform/rendering_field_html_{$elementName}] to add a custom data attribute to specific input fields (e.g. name, email).

    When using your example, I get an error / blank screen.
    add_filter(‘fluentform/rendering_field_html_input_email’, function($html, $data, $form){ return $form; }, 10, 1);

    How would you add data-form-detail=’xyz’ to an input field (type=email).

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Lukman Nakib

    (@pyrobd)

    Hello there,
    Just wrote the code snippet for you, check this link.
    Hope that helps.
    Feel free to let us know if you need anything else.

    Thanks

    Thread Starter devpii

    (@devpii)

    Hi,
    thank you very much, works perfectly.

    I have one other request. I also would like to reformat some input fields to a custom element.
    For example:
    <my-input> instead of <input>
    <my-custom-textarea></my-custom-textarea> instead of <textarea></textarea>

    Is that possible via filters and str_replace?

    Thanks

    Plugin Author Lukman Nakib

    (@pyrobd)

    Yes, and try using this hook fluentform/rendering_field_html_{$elementName} replace and return the html. It should work. Let me know if you face any problems.
    Thanks

    Thread Starter devpii

    (@devpii)

    Thanks it works now.

    When using the example from your docs (https://fluentforms.com/docs/fluentform_rendering_field_html_elementname/) I got a php error.

    add_filter(‘fluentform/rendering_field_html_input_email’, function($html, $data, $form){
    return $form;
    }, 10, 1);<br>

    The return value has to be $html
    $targetElement = 'input_text';
    add_filter('fluentform/rendering_field_html_' . $targetElement, function($html, $data, $form){
    return $html;
    }, 10, 3);<br>

    • This reply was modified 2 years, 5 months ago by devpii.
    Plugin Author Lukman Nakib

    (@pyrobd)

    Yes return value need to be html , glad to hear that its working . Hope you are having a good experience using fluent forms. If you are satisfied with the fluent form plugin ands its ux, please don’t forget share your feedback by leaving a review for us.
    Have a great day ahead.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Filter Hook – [fluentform/rendering_field_html_{$elementName}]’ is closed to new replies.