I got this working.
<form>
<label for="inputField01">Employee #01:</label>
<input type="text" id="inputField01" value="John Doe">
</form>
jQuery(document).ready(function($) {
$('#inputField01').on('input', function() {
$('label[for="inputField01"]').text('Employee #01: ' + $(this).val());
});
$('label[for="inputField01"]').text('Employee #01: ' + $('#inputField01').val());
});
Hope this helps.
Hi Giulia, did you ever figure this out?
Cheers, Brian
I’m facing a similar challenge and I’m wondering if you ever found a solution.
My scenario:
ARCHIVE has the exact same fields as above.
After field [Date out] reaches a certain date, I want that specific row to be moved (or copied) from the ACTIVE to the ARCHIVE.
Hope I make sense.
Thanks in advance!
Thanks for your solution. It definitely got me on the right track.
My working solution with ACF Post Object (Multi Selection) looks like this:
// Post Object variable
// In my case a subfield, because it's in a group
$acf_post_object = get_sub_field('acf_post_object');
// Get the ID of the Post Object
$featured_img_id = get_post_thumbnail_id( $acf_post_object[0]->ID );
// Get the URL of the Post Object's featured image
$featured_img_url = wp_get_attachment_image_url($featured_img_id, 'thumbnail' );
// Use the url
echo $featured_img_url;
Thanks for your reply. I figures it out. I concentrated solely on the load_field code and not on the Options Page, which is mandatory.
For those struggling, add this to your functions.php
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
and add your source data there.
function acf_load_field_choices( $field ) {
// reset choices
$field['choices'] = array();
// if has rows
if( have_rows('ACFG01-F01', 'option') ) {
// while has rows
while( have_rows('ACFG01-F01', 'option') ) {
// instantiate row
the_row();
// vars
$value = get_sub_field('ACFG-F01-SOURCE');
$label = get_sub_field('ACFG-F01-SOURCE');
// append to choices
$field['choices'][ $value ] = $label;
}
}
// return the field
return $field;
}
add_filter('acf/load_field/name=ACFG-F01-TARGET', 'acf_load_field_choices');
Anyone?
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.