Field group not loading collapsed when editing a front end post

Support MB Group Field group not loading collapsed when editing a front end postResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #47077
    Nicholas CoxNicholas Cox
    Participant

    Hi

    When using the front end form and editing a post and using a field group with the option 'default_state' => 'collapsed' the form loads with the groups expanded and not collapsed. This works for new posts, just not for editing a post. Is there a reason it does not stay collapsed when editing a post?

    shortcode
    [mb_frontend_form id="dc-product" post_type="products" confirmation="Updated Product Successfully" submit_button="Update" allow_delete="true" ajax="true" edit="true"]

    Field Group

    [
    	'type' => 'group',
    	'id'   => 'brand',
    	'name' => 'Brand Information',
    	'group_title' => 'Brand',
    	'clone' => false,
    	'collapsible' => true,
    	'default_state' => 'collapsed',
    	'save_state' => true,
    	'fields' => [
    		[
    			'type'  => 'text',
    			'name'  => 'Brand Name', //label for form
    			'id'    => 'product_brand',
    			'required' => false,
    			'columns' => 12,
    		],
    	]
    ]

    thanks

    Nick

    #47078
    Nicholas CoxNicholas Cox
    Participant

    using the url parameter to populate the front end form e.g. http://localhost/testsite/edit-product/?rwmb_frontend_field_post_id=479

    #47085
    PeterPeter
    Moderator

    Hello Nick,

    The setting save_state is set to true, that means will save the state collapse or expand when you save the post. Do you expand the group when saving the post? Please recheck this and let me know how it goes.

    #47243
    Nicholas CoxNicholas Cox
    Participant

    Yes i expand the group before saving the post.

    #47253
    PeterPeter
    Moderator

    Hello,

    Can you please share a screen record of the issue on your site?

    #47261
    Nicholas CoxNicholas Cox
    Participant

    Hi,

    I did some investigation and turns out i had some JS issues which was affecting the form and not related to metabox scripts. So thanks anyway, i find it hard sometimes to debug JS errors.

    To confirm the save_state works as it should.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.