Problem with default value of field types
Support › MB Settings Page › Problem with default value of field typesResolved
- This topic has 5 replies, 3 voices, and was last updated 7 years, 2 months ago by
Truong Giang.
-
AuthorPosts
-
November 30, 2017 at 7:11 PM #7713
Hazmi
ParticipantHi,
i'm using latest plugin version. Today i noticed, that my custom fields of types (text, datetime, .. and maybe other) have a default value of empty brackets "[]" - if i setup "std" to another default value, nothing is happen - still the brackets. If i change value to something and make save, the value is correctly saving..
Next, i have noticed, that developer console only on settings page has "Uncaught ReferenceError: QTags is not defined".
add_filter( 'mb_settings_pages', 'mb_v2018' ); function mb_v2018( $settings_pages ) { $settings_pages[] = array( 'id' => 'v2018', 'menu_title' => __('Settings',TEXTDOMAIN), 'parent' => 'edit.php?post_type=vol2018' ); return $settings_pages; }
...
$meta_boxes[] = array( 'id' => 'vol_options', 'title' => __('Options',TEXTDOMAIN), 'settings_pages' => 'v2018', 'fields' => array( array( 'name' => __('Something', TEXTDOMAIN ), 'id' => "{$prefix}something", 'type' => 'text', 'std' => 'test' ) ) )
December 1, 2017 at 10:55 AM #7726Anh Tran
KeymasterHi Hazmi,
Regarding the 1st problem, can you please describe steps to replicate it? I couldn't replicate on my side. But my guess is the saved value in the DB. If you already saved values of your fields into an option, then when you add a new field which has name already registered before, then the value might be taken from the previous one. Not sure if that's the case, but you can try remove the option in the DB and try again.
Regarding the problem with QTag, do you have any wysiwyg field in your settings page? QTags is available only for the editor. With the code above, I can't see anything in the console:
December 1, 2017 at 3:12 PM #7730Hazmi
ParticipantHi,
1/ i have a setting page from the code i have posted, every custom field for user input (text, datetime, ..) i create has an "[]" as default value :/ and param "std" with my value doesn't work
A new problem for me here - custom field "taxonomy" on setting page doesn't save my data ("taxonomy_advanced" is ok) :/
2/ no, i haven't any wysiwyg
December 5, 2017 at 11:01 AM #7752Truong Giang
ParticipantHi there,
Taxonomy field doesn't save data to post meta or options, it is used for assigning a taxonomy to a post. You should use taxonomy_advanced instead. Read more here: https://docs.metabox.io/fields/taxonomy/#data
For other problems, please wait for us to check it.
Thanks.
February 9, 2018 at 5:29 PM #8517Hazmi
ParticipantHi,
any progress with this (2 months)?
February 10, 2018 at 1:27 PM #8521Truong Giang
ParticipantHi there,
Sorry for late reply. I checked many times but can't get your problem. Did you try with 2017 theme and all plugins are deactivated?
-
AuthorPosts
- You must be logged in to reply to this topic.