Title: Pre-filling Select Fields
Last modified: September 22, 2018

---

# Pre-filling Select Fields

 *  Resolved [jc57](https://wordpress.org/support/users/jc57/)
 * (@jc57)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/pre-filling-select-fields/)
 * Trying to pre-fill choices in a select field and having no luck. Have tried arrays,
   comma separated values, /r, /n, and /r/n separated values and nothing seems to
   work. I can pre-fill text fields, so I know the $args are being read, but can’t
   get the select to work. Any suggestions?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fpre-filling-select-fields%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [fabianlindfors](https://wordpress.org/support/users/fabianlindfors/)
 * (@fabianlindfors)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/pre-filling-select-fields/#post-10759863)
 * Hi! Sorry about the late reply.
 * Using an array works for me while testing. I’ve set up a multiple select field
   and am passing an array of the values I wan’t selected to $args. Something like
   this:
 *     ```
       $args = array(
         'select' => array( 'value2', 'value3' ),
       );
       ```
   
 * What does your code look like? 🙂
 *  Thread Starter [jc57](https://wordpress.org/support/users/jc57/)
 * (@jc57)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/pre-filling-select-fields/#post-10764244)
 * I was under the impression that profile values have to go in the “values” array
   and was trying something like this:
 *     ```
       $args = [
            'values' => ['adminSecName' => array("a", "b"), 'adding' => 'YES']
       ];
       ```
   
 * where ‘adminSecName’ is the field name for the select box I’m working with.
 * In your example it looks like you’ve specified the field name as it’s own key
   in the array. That didn’t seem to work for me either, but is it supposed to?
 *  Plugin Author [fabianlindfors](https://wordpress.org/support/users/fabianlindfors/)
 * (@fabianlindfors)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/pre-filling-select-fields/#post-10765091)
 * Oh, of course. The values are supposed to go in the `values` part of `args`, 
   my example was wrong.
 * The way you have written it is the way I tested and it should work. Are you sure`
   a` and `b` are the actual values for the options? In ACF it’s possible to define
   both a value and a label for each of the options like this: “value : Label”. 
   It’s the value that needs to be specified. 🙂
 *  Thread Starter [jc57](https://wordpress.org/support/users/jc57/)
 * (@jc57)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/pre-filling-select-fields/#post-10765453)
 * Yes, those are the values, but nothing shows up. Iv’ve tried it with the ‘value:
   label’ option as well and still don’t get anything. Any more ideas?
 *  Thread Starter [jc57](https://wordpress.org/support/users/jc57/)
 * (@jc57)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/pre-filling-select-fields/#post-10765619)
 * Found a solution by going to an ACF hook. Answer is at [https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/](https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/).
 *  Thread Starter [jc57](https://wordpress.org/support/users/jc57/)
 * (@jc57)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/pre-filling-select-fields/#post-10765620)
 * Just forgot to mark as Resolved

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Pre-filling Select Fields’ is closed to new replies.

 * ![](https://ps.w.org/advanced-forms/assets/icon-256x256.png?rev=1894254)
 * [Advanced Forms for ACF](https://wordpress.org/plugins/advanced-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-forms/reviews/)

## Tags

 * [pre-fill](https://wordpress.org/support/topic-tag/pre-fill/)
 * [select](https://wordpress.org/support/topic-tag/select/)

 * 6 replies
 * 2 participants
 * Last reply from: [jc57](https://wordpress.org/support/users/jc57/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/pre-filling-select-fields/#post-10765620)
 * Status: resolved