Support

Account

Home Forums Feature Requests New JavaScript filter 'should_submit'

Unread

New JavaScript filter 'should_submit'

  • Hi there, I have a site that loads every page via AJAX. On one of those pages I would like to use acf_form() and it should not reload the page on submit. For that, a new JS filter in acf-input.js would be great, just after acf.do_action('submit', $form);:

    
    // action for 3rd party customization
    acf.do_action('submit', $form);
    
    // filter for 3rd party customization
    var shouldSubmit = acf.apply_filters('should_submit', true, $form);
    
    if( shouldSubmit ) {
    	// submit form again
    	if( this.$trigger ) {
    		
    		this.$trigger.click();
    
    	} else {
    		
    		$form.submit();
    
    	}
    }
    
    

    That way I could prevent ACF from submitting the form and use my own logic for that.

Viewing 1 post (of 1 total)

The topic ‘New JavaScript filter 'should_submit'’ is closed to new replies.