"std" => "" value dissapears on text when text_list or key_value is set to clone

Support General "std" => "" value dissapears on text when text_list or key_value is set to clone

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #10842
    makeagencymakeagency
    Participant

    I've included 2 images as examples.
    I'm using the text_list on this occasion but was previously trying with the key_value metabox.

    Here with the clone property disabled: https://pasteboard.co/HxjKX2f.png
    Here with the clone property enabled: https://pasteboard.co/HxjLJfx.png

    #10846
    makeagencymakeagency
    Participant

    To clarify:

    I have multiple fields, a few of these fields are set to readonly, as i don't want them to be edited but git a que for the content that should be added below these fiels.

    // TEXT
    array(
        'name' => 'Section:',
        'id' => "{$prefix}academy_opening_times_title_note",
        'type' => 'text',
        'std' => 'Opening Times:',
        'readonly'  => true,
    ),

    When ever this field or the key_value field has clone set to true, the std text isn't displaying.

    
    array(
        'name'    => 'Opening times:',
        'id'      => "{$prefix}academy_opening_times",
        'type'    => 'text_list',
        'clone' => true, // Clone set to true
        'options' => array(
            'Monday - Friday'      => 'Day(s)',
            '8am-6pm' => 'Time(s)',
        ),
        'add_button' => '+ Day(s) / Time(s)',
    ),
    

    I hope the images provided in my original post show the output.

    #10862
    Anh TranAnh Tran
    Keymaster

    Hi, I don't see you set std attribute for the field?

    #10866
    makeagencymakeagency
    Participant

    Hi,
    In the first snippet 'std' => 'Opening Times:',

    Perhaps you're misunderstanding my issue.

    The std value isn't present on any of the fields that have it set (i.e. on every text field, see images attached originally to this post) when the 'type' => 'text_list' field is set to'clone' => true,

    #10879
    Anh TranAnh Tran
    Keymaster

    I got it. I was looking for the std of text_list field.

    By the way, the std is used only when the post hasn't been saved. Once it's saved, the values are stored in the DB and will be used next time when page loads.

    Do you see that happen with new posts?

    #10897
    makeagencymakeagency
    Participant

    Hi,

    No I don't 🙁 , i only see it when the clone on the text_list is set to false.

    You can see in the images i posted what is visible for each scenario.

    #10906
    makeagencymakeagency
    Participant

    Here's a grab of the metabox code:

    https://ghostbin.com/paste/weyx9

    #10920
    Anh TranAnh Tran
    Keymaster

    Thanks a lot for your code! It really helps. I've fixed it on Github.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘"std" => "" value dissapears on text when text_list or key_value is set to clone’ is closed to new replies.