Home › Forums › Backend Issues (wp-admin) › New field type: select › Reply To: New field type: select
So I’ve managed to store my select field’s value, by passing it to a hidden input field, which works fine. But now I’m facing some trouble with the repeater field.
ACF generates a repeater’s subfield $field[‘name’] and $field[‘ID’], by replacing [acfcloneindex] by an $i integer value, through the use of javascript–see this post for reference.
I haven’t found a way to get around the [acfcloneindex] riddle yet, but I’m wondering how ACF stores its own select fields values.
I’m generating the select code of my field using the same structure as ACF, but ACF won’t store the value upon saving the post:
echo '<select id="' . esc_attr($field['id']) . '" name="' . esc_attr($field['name']) .'" data-ui="0" data-ajax="0" data-multiple="0" data-placeholder="Select" data-allow_null="0">';
$output .= '<option value="0"></option>';
foreach($options as $option){
...
}
echo $output . '</select>';
So the question is, what am I missing? How can I store my select field’s value?
I figure there has to be a better way than by using hidden inputs, right?
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.