• Resolved donpro

    (@donpro)


    Hi,

    As there is no option for adding a hidden field in the plugin, I tried the following JS code snippet to create a class but it’s not working. Can anyone tell me why? I add the class, wpf-hidden-field, to the input field I want to hide

    /**
     * Make standard form fields to make hidden
     * To apply, add CSS class 'wpf-hidden-field' (no quotes) to field in form builder
     *
     */
     
    function wpf_dev_hidden_field() {
        ?>
        <script type="text/javascript">
     
        jQuery(function($) {
     
            $( '.wpf-hidden-field input, .wpf-hidden-field textarea' ).attr({
                 display: "none"
            });
             
        });
     
        </script>
        <?php
    }
    add_action( 'wpforms_wp_footer_end', 'wpf_dev_hidden_field', 30 );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter donpro

    (@donpro)

    I also see that a paid license cpomes with the option to add a hidden field so that wil work for me. Still curious why the above does not.

    Hi @donpro- Sorry about the confusion you are facing here!

    On taking a look at the code, I see you are using attr instead of css. However, adding a custom field is not necessary as you can use the inbuilt CSS Class to hide a field from the front end:

    wpforms-field-hidden — Reference screencast here and also you can refer to this guide for more information

    In case you’d like more details about the features in the paid version, please feel free to drop us a line through our contact page when you get the chance?

    Thanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hidden form field’ is closed to new replies.