Title: Booking Form Required Fields
Last modified: August 20, 2016

---

# Booking Form Required Fields

 *  Resolved [geologist](https://wordpress.org/support/users/geologist/)
 * (@geologist)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/)
 * It seems as though the only field required to submit the Booking Form is the 
   email. Is there a way to make other fields required? Specifically the Name field?
 * [http://wordpress.org/extend/plugins/events-manager/](http://wordpress.org/extend/plugins/events-manager/)

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

 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3157976)
 * Not without adding some PHP to hook into the event saving process (specifically
   em_event_validate fired in classes/em-event.php)
 * Alternatively, Pro has a custom booking form feature that allows required fields
   to be added.
 *  Thread Starter [geologist](https://wordpress.org/support/users/geologist/)
 * (@geologist)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3157986)
 * Thanks Marcus. Knowing which file to modify is a big help. Not quite ready to
   buy the Pro version yet; not till we’re ready to start accepting online payments.
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3157990)
 * you can try this snippet (paste in your theme functions.php)
 *     ```
       function em_validate(){
        global $EM_Event,$EM_Notices;
        if ($_REQUEST['field_name'] == ''){
         $EM_Notices->add_error('guest name is required...');
        }
       }
       add_filter('em_event_validate','em_validate');
       ```
   
 *  Thread Starter [geologist](https://wordpress.org/support/users/geologist/)
 * (@geologist)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3157995)
 * This is not quite working. After adding the validation function to my theme functions
   file, the user always get the message “guest name is required…”. This happens
   when any required information is left off the form (either name or email). It
   also happens when all correction info is put in the form, and no registration(
   booking) occurs.
 * I should clarify. Are you suggesting that I add the validation function to the
   functions file in addition to modifying the em-event.php file?
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158010)
 * you need to change ‘field_name’ to that of your html input field e.g. user_name
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158011)
 * mind you you may want to change that to e.g.
 *     ```
       function em_validate(){
        global $EM_Event,$EM_Notices;
        if (!is_user_logged_in() && $_REQUEST['user_name'] == ''){
         $EM_Notices->add_error('guest name is required...');
        }
       }
       add_filter('em_event_validate','em_validate');
       ```
   
 *  Thread Starter [geologist](https://wordpress.org/support/users/geologist/)
 * (@geologist)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158013)
 * Still no booking taking place, even when all required fields are completed. When
   email is left blank an empty red box displays for a message, but there is no 
   text in the box. The “guest name is required” message is is working correctly.
 * I have this set up so that guest does not have to be logged in or be a registered
   WordPress User to book an event. So I’m thinking that `(!is_user_logged_in()`
   should not be in the function, but deleting it completely breaks my site.
 *  Thread Starter [geologist](https://wordpress.org/support/users/geologist/)
 * (@geologist)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158014)
 * Correction – I deleted too much from `!is_user_logged_in()`. But even when I 
   modify that correctly, it doesn’t help. Same issues as listed above.
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158015)
 * > I have this set up so that guest does not have to be logged in or be a registered
   > WordPress User to book an event
 * have you tried No-User Booking Mode -> [http://wp-events-plugin.com/documentation/booking-options/](http://wp-events-plugin.com/documentation/booking-options/)
 * Settings > Bookings > No-User Booking Mode
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158018)
 * oops, missed something else out in the above, since it’s a filter:
 *     ```
       function em_validate($result, $EM_Event){
        if (!is_user_logged_in() && $_REQUEST['user_name'] == ''){
         $EM_Event->add_error('guest name is required...');
         $result = false;
        }
        return $result;
       }
       add_filter('em_event_validate','em_validate', 1, 2);
       ```
   
 *  Thread Starter [geologist](https://wordpress.org/support/users/geologist/)
 * (@geologist)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158024)
 * Yes, Agelonwl. I have seen the booking-options and the No-User Booking Mode. 
   Am I missing something? I don’t see anywhere that I can specify which fields 
   on the booking form are required.
 *  Thread Starter [geologist](https://wordpress.org/support/users/geologist/)
 * (@geologist)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158025)
 * Alright Marcus, that worked!!
 * Thanks so much.
 * This is a great plugin!

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

The topic ‘Booking Form Required Fields’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 12 replies
 * 3 participants
 * Last reply from: [geologist](https://wordpress.org/support/users/geologist/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/booking-form-required-fields/#post-3158025)
 * Status: resolved