• Resolved Dennis Dallau

    (@yorlinqnl)


    I love the ‘Override the native field groups HTML render‘ option although this option is not suitable if your form uses conditional logic or populated fields (via php) because the rendering gets lost.

    It would be very nice if you could have a shortcode for a complete field output.

    F.i.

    <div class="this is so nice">
        {field_5edfd827bf0bb OUTPUT}
    </div>

    would output on frontend something like this:

    <div class="this is so nice">
        <input type="number" id="acf-field_5ed41854d63dd" class="" name="acf[field_5edfd827bf0bb]" min="1" max="4" step="any" required="required">
    </div>

    In that case you can use complete custom html and still be flexible with conditions and other php implemented stuff 🙂

    What do you think 🤔?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback. This feature already exists in the “Override Form Render”. You have to use the following template tag, as described in the field instructions: {field:my_field} (field name) or {field:field_123456abcd} (field key) to print the actual field. You can also print the whole field group.

    Conditional logic are also compatible, but you need to make sure that all fields that are part of your condition are printed in the form, otherwise the condition won’t get validated.

    Here is an example, I created a form with a field group and added conditions on the “Final field”.

    Override Form Render: https://i.imgur.com/gZiaXi6.png
    Field Group: https://i.imgur.com/97UMg07.png
    Final field conditions: https://i.imgur.com/Y0Hc7w0.png
    Video of the Front-end form: https://i.imgur.com/U77ZAy9.mp4

    Note: the conditional logic set in PHP are also working.

    Have a nice day.

    Regards.

    Thread Starter Dennis Dallau

    (@yorlinqnl)

    Yeah that’s indeed a start (I was aware of) although these shortcodes actually display the whole DIV HTML stuff around it too. Even the label is rendered within this shortcode.

    There is no option to JUST render: <input....> instead of the whole surrounding DIVS aswell??

    Tnx m8

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Unfortunately, that logic is tied to ACF core and cannot be changed. Those div wrapper are necessary for ACF to work correctly (field conditions, dynamic fields with JS etc…).

    If you want to hide field labels, you can leave labels empty in the field group, or use the “Advanced Settings” feature to hide label on specifc screen (Front-end for example). You can also add your own class using the native “wrapper > class” settings in the field.

    Hope it helps.

    Regards.

    Thread Starter Dennis Dallau

    (@yorlinqnl)

    SOLVED

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

The topic ‘Feature request: {FIELD SHORTCODE}’ is closed to new replies.