• Resolved jonboldendesign

    (@jonboldendesign)


    I’m hoping to make a custom attributes a required field on the front-end submission form. I don’t see any documentation for it.

    Ideally it would be something like this

    #_ATT{key*}
    * to denote a required field

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    Hi,

    you can try to hook into em_event_validate filter located under classes/em-event.php and maybe the below snippet can help you get started however it might not work out of the box

    
    function my_required_att(){
    	global $EM_Event;
    	$EM_Event->event_attribute1 = !empty($_POST['em_attributes']['att1'] ) ? wp_kses($_POST['em_attributes']['att1'], array()):'';
    
    	if( empty($EM_Event->event_attribute1) ){
    		$validate_post = false;
    		$EM_Event->add_error( __('att1').__(" is required.", "dbem") );
    	}
    }
    add_filter('em_event_validate','my_required_att');
    

    where ‘att1’ is an event attribute

    • This reply was modified 7 years, 1 month ago by angelo_nwl.
    Thread Starter jonboldendesign

    (@jonboldendesign)

    Worked perfectly. Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Required fields for custom attributes?’ is closed to new replies.