kabienf
Forum Replies Created
-
Hi @mkonji,
If you still have this issue, I think my comments here might be related.
https://ww.wp.xz.cn/support/topic/multi-select-field-callbacks-irregularities-when-saving/#post-11641408Thanks for the feedback @krolyn,
For information, If you ever need a quick way to bypass this behavior, the code that prevents a value that is not set in the field’s options list to be saved while submitting the form is in the file class-validation.php, line 75 :
if ( in_array( $fields[ $key ]['type'], array( 'select', 'radio' ) ) && isset( $value ) && ! empty( $fields[ $key ]['options'] ) && ! in_array( $value, $fields[ $key ]['options'] ) ) { unset( $changes[ $key ] );I tried to comment this line and was able to save my field value.
That should work until the next release.Hello @krolyn,
Sorry, my answer will not give you the solution, I just wanted to let you know that I face the exact same problem with callback on dropdown (I ask a question about it on this subject: https://ww.wp.xz.cn/support/topic/bug-using-choices-callback-field-not-visible-in-view-mode/#post-11640656).
All options added by the callback and that have not been “displayed” in the field edit mode in the choices list will not be saved.
This prevent using callbacks to populate dropdown or multi-select options with new values from the database 🙁Hi @nathekame,
I have a similar callback function that get datas from the database depending on the parent_option value and I did as you suggested, putting a * in the “Edit choices” as it can’t be empty.
In my form, my child dropdown is filled with all options from my callback function, matching with my parent dropdown selection, so everything is OK for the form display.
The problem I am facing is that after submitting the form, this value is not saved in my user meta.After some tests, I arrived to the conclusion that if the selected value does not match with a value set in the “Edit choices” field of the dropdown settings, then it is not saved in user meta.
It is a problem for me as I want my dropdown to be filled with options that can be inserted in my db by other users.Don’t you face the same problem with your LGA dropdown ?
Thanks,