Limit Attendee Questions to a particular form

WordPress Event Management, Calendars & Registration Forums General Question Limit Attendee Questions to a particular form

This topic contains 2 replies, has 2 voices, and was last updated by  Stephen Harris 3 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #39977

    I would like to attach Attendee Questions to just one of several EO forms on my site. Is it possible to use a simple conditional around the Attendee Questions code, such as:

    function my_attach_attendee_questions( $form ) {
        if ( [form ID] === [ID] ) {
             [Attendee Questions code]
        } 
    }
    

    If so, how exactly do I address the form ID? Is it ‘$form->id’? Please excuse my ignorance.

    Michael Docker
    #39994

    I seem to have figured this out for myself:

     function my_attach_attendee_questions( $form ) {
            $form_name = $form->get( 'name' );
            if ( $form_name === 'test-form' ) {
                 [Attendee Questions code]
            }  
     }
    

    That does the trick.

    In answer to a previous question you suggested that it would be possible to ‘use some javascript to pre-fill the first set of fields’ in the Attendee Questions. Where would that javascript go? Unlike WordPress pages and posts there doesn’t appear to be a place for Scripts in the Event editor.

    Michael Docker
    #40039

    Hi Michael,

    Scripts would have to be loaded using the WordPress api (e.g. wp_enqueue_script).

    As for the JavasScript itself, you could use jQuery to listen to changes in the attendee question div, and if the first section is empty, pre-populate it with the relevant details. All fields and container divs should have appropriate classes so you can target them.

    Stephen Harris
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.