Support

Account

Home Forums Feature Requests Ignore required fields only if post status is Draft

Helping

Ignore required fields only if post status is Draft

  • Hi people,
    I want to ignore required fields only if I’m saving a draft (click #save-post => click_ignore).
    All the others POST STATUS (pending, publish, future_publish, CUSTOM_POST_STATUS) need to validate all required fields.
    How I can do it?

  • Now i solved editing the function click_ignore like that

    click_ignore: function( e ) {
    	if(jQuery('#post_status').val()=='pending'){
    		this.$trigger = e.$el;
    	} else {
    		// reference
    		var self = this;
    		
    		
    		// vars
    		this.ignore = 1;
    		this.$trigger = e.$el;
    		this.$form = e.$el.closest('form');
    		
    		
    		// remove error message
    		$('.'+this.message_class).each(function(){
    			acf.remove_el( $(this) );
    		});
    		
    		
    		// ignore required inputs
    		this.ignore_required_inputs();
    		
    		
    		// maybe show errors
    		setTimeout(function(){
    			self.ignore = 0;
    		}, 100);
    	}
    	
    }
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Ignore required fields only if post status is Draft’ is closed to new replies.