Tagged: Field values
- This topic has 5 replies, 2 voices, and was last updated 6 years, 2 months ago by
bubdev.
-
AuthorPosts
-
-
November 21, 2015 at 7:45 am #5053
bubdevMemberHi,
I have an Add-more group that is grouped together with a textfield, which is used for a heading. If the outer group is given a field name, the value of the text field isn’t showing. When I remove the field name, the value shows up but the whole construction somehow falls apart.
Same situation with another nested group (value doesn’t show if outer group is given a name). But that one doesn’t have an addmore and therefore doesn’t fall apart when I remove the field name.
Below is my code for the problematic Add-more group. I’m not sure if it’s a bug or if I’m doing it wrong.
piklist('field', array( 'type' => 'group' ,'field' => 'bub_title_shoplinks_container ' ,'label' => __('Shoplinks') ,'description' => __('Links zu den Produktseiten ausgewählter Shops.') ,'attributes' => array( 'class' => 'bbe-group' ) ,'fields' => array( array( 'type' => 'text' ,'field' => 'bub_title_shoplinks_heading' ,'label' => __('Titel') ,'value' => 'Kaufen' ,'attributes' => array( 'class' => 'bbe-title' ,'placeholder' => 'Eigener Titel' ) ) ,array( 'type' => 'group' ,'field' => 'bub_title_shoplinks' ,'label' => __(' ') ,'attributes' => array( 'class' => 'bbe-group' ) ,'add_more' => true ,'fields' => array( array( 'type' => 'text' ,'field' => 'bub_title_shoplinks_title' ,'label' => __('Beschriftung') ,'columns' => 4 ,'attributes' => array( 'class' => 'bbe-text-left' ,'placeholder' => 'Titel des Links' ) ) ,array( 'type' => 'text' ,'field' => 'bub_title_shoplinks_address' ,'label' => __('Adresse (URL)') ,'columns' => 8 ,'attributes' => array( 'class' => 'bbe-text-right' ,'placeholder' => 'http://...' ) // ,'validate' => array( // Validation errors for Links with '%' (e.g. Umlauts) // array( // 'type' => 'url' // ) // ) ) ) ) ) ));Thank you – Stefan
-
November 21, 2015 at 7:54 am #5054
bubdevMemberAnd of course: When I say the value of the text field isn’t showing, I’m talking about the first text field (my heading) and it’s default value (‘value’ => ‘Kaufen’).
-
November 23, 2015 at 11:46 am #5066
bubdevMemberOkay, this kind of nesting seems to be problematic in the first place (empty arrays). Now, after cleaning up the database and removing the outer group, it’s less pretty but it works again, including the default values showing up. 🙂
-
November 23, 2015 at 12:40 pm #5078
SteveKeymaster@bubdev– We’ll take a look at this issue anyway.
You could also just remove
,'field' => 'bub_title_shoplinks_container '. The data will now save as individual meta fields instead of in one big array.If you go this route, take a look at the data and make sure you are happy with it.
Also, the default value shows up when I remove that field.
-
November 23, 2015 at 1:41 pm #5080
bubdevMemberThat’s exactly how it was before it “suddenly” stopped working and I got “Illegal string offset” messages. However, now after deleting all corresponding entries from the database and trying again, everything works like a charme.
Can this be a result of changing (and changing back) field names after there have already been made entries to the database? Because that’s probably something I’ve done.
Thanks a lot, Steve.
-
November 23, 2015 at 2:34 pm #5082
bubdevMemberNo, not working. After adding more than one add-more, all inputs loose their values, and the heading (‘bub_title_shoplinks_heading’) is being treated as part of the add-more.
I used the exact same code as above without the outer field name. When I add it back in, the fields look fine in the backed but will stop working on the frontend, as experienced before.
I think I’ll confine myself with the simpler variant for now.
-
-
AuthorPosts
- You must be logged in to reply to this topic.