Okay
  Public Ticket #2747818
new required fields
Closed

Comments

  • netaservice started the conversation

    With this code, we can add new fields. 

    We would like to know how to indicate that these new fields are mandatory
    Also know, how to make the fields that are already in the form, 
    mandatory or optional.

    Thank you in advance. Great plugin!

    /**
     * This code adds two custom fields (text input and select element) on the front-end modal window
     */
    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                $(document).on('stecOnRsvpAfterFields', function (e, data) {
                    var customHtml = [
                        '<input type="text" name="attendee_country" placeholder="Country" />',
                        '<select name="attendee_tag"><option value="1">Tag</option></select>'
                    ];
                    data.temp.customFields = customHtml;
                });
            })(window.jQuery);
        </script>
        <?php
    });-->
    
  •  894
    Zhivko replied

    Hi,

    Sorry for the late reply.

    Fields can be set as required by adding "required" attribute to the input.

    Example:

    '<input required type="text" name="attendee_country" placeholder="Country" />',        
    '<select required name="attendee_tag"><option value="1">Tag</option></select>'

    The default input values can't be modified via filters. 


    Stachethemes Developer