• Hey

    I have created select field Like Car model and it has options like ford,Audi etc.

    Now I need to save that value in post.

    I don’t know whats wrong with af_save_field,It saves the value of text,numbers,images,galleries but not the selected option.

    Any help will be appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi!

    af_save_field should work with select fields as well. Are you using the same field in both the field and the post you are trying to save to?

    Thread Starter ash6789

    (@ash6789)

    Hey

    Actually First Select Field have options (Dynamically coming from SQL)
    and on click of first select field , Second field options comes dynamically.

    All is good except that

    af_save_field saves the value of First select field but not for the second one.

    Thread Starter ash6789

    (@ash6789)

    Here is code

    af_save_field('select_field_2', $post_id);
    
        af_save_field('test_field_1', $post_id);

    test_field_1 stores its vaue but select_field_2 doesn’t.

    Plugin Author fabianlindfors

    (@fabianlindfors)

    I haven’t tried this myself but there might be a problem if the select options are loaded dynamically. Are these options loaded in the backend as well?

    If they are not then ACF probably won’t be able to display/save the value because there aren’t any options to populate the select field with.

    Maybe you could attach some screenshots of your form and fields as well? Thanks!

    Thread Starter ash6789

    (@ash6789)

    Yes these options are loaded dynamically from the database.So I was not able to store their value.What I did on selecting the option I store their value in an hidden input field then Showed that field on admin panel.

    Plugin Author fabianlindfors

    (@fabianlindfors)

    So you managed to solve your issue? ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Save the select option value in acf forms’ is closed to new replies.