Home › Forums › ACF PRO › Custom Preview Button Not Working › Reply To: Custom Preview Button Not Working
Thank you for your reply.
I found that it works when adding the following event to “acf.validation events” on line 12847 of acf-input.js.
acf.validation = new acf.Model({
/** @var string The model identifier. */
id: 'validation',
/** @var bool The active state. Set to false before 'prepare' to prevent validation. */
active: true,
/** @var string The model initialize time. */
wait: 'prepare',
/** @var object The model actions. */
actions: {
'ready': 'addInputEvents',
'append': 'addInputEvents'
},
/** @var object The model events. */
events: {
'click input[type="submit"]': 'onClickSubmit',
'click button[type="submit"]': 'onClickSubmit',
'click #save-post': 'onClickSave',
'mousedown #post-preview': 'onClickPreview', // use mousedown to hook in before WP click event
'submit form': 'onSubmit',
'mousedown #custom-preview': 'onClickPreview' // Add New
},
However, I didn’t know how to add this process without changing the core file. (I know that filters model.filters exists, but I didn’t know how to write correctly.)
How can I add events to acf.validation?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.