This inserts a second button to an ACF form using jQuery.
The form contains a hidden field ‘current_step’ which is set to a value of ‘1’ for normal submission.
The second button includes onclick=”buttonA_clickHandler(event);” which overrides the saved hidden field ‘current_step’ value to 2.
Its a quick (dirty) hack I have found useful.
<?php
acf_form(array(
‘post_id’ => $user_fact_find_id,
‘field_groups’ => array( 193 ),
‘id’ => ‘step1’,
‘html_after_fields’ => ‘<input type=”hidden” id=”hiddenId” name=”acf[current_step]” value=”1″/>’,
‘label_placement’ => ‘left’,
‘submit_value’ => __(‘Save Step 1’),
‘updated_message’ => __(“Post updated”, ‘acf’),
));
?>
<input type=”submit” id=”myBtn” class=”acf-button2 button button-primary button-large” name=”4″ value=”Next” onclick=”buttonA_clickHandler(event);”>
<script>
jQuery(“#myBtn”).detach().appendTo(‘.acf-form-submit’);
function buttonA_clickHandler(event) {
document.getElementById(‘hiddenId’).value = 2;
document.getElementById(‘step1’).submit();
}
</script>
Thanks for the feedback Fluvio
http://www.artificialart.co.uk/acf-user-search-select.zip
https://github.com/artificialart/acf-user-search-select
Above setup as plugin. Tested on ACF v4 & WP 3.6 only
Works with repeater field
Will submit to http://wordpress.org/plugins/add/ when we get round to readme and screenshots
To use just start typing into user search field- results should appear below, then click on result to select.
Hope it works for you. Please let us know.
Hi Elliot
Thanks for getting back to me.
Ill send you a copy when its done. I suspect a few other people that complain ACF has slowed their site have the same problem.
BTW thanks for a great plugin.