js_options causing error

Support MB Frontend Submission js_options causing error

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #46931
    YasmineYasmine
    Participant

    Hello,

    I have recently got a problem with a post (cpt) field not loading the post options .

    I have done some testing and have found it was this:

    'js_options'  => [
            'minimumInputLength' => 2, 
        ]

    It used to work but now no longer works. Can you confirm if you see the issue too?

    #46935
    PeterPeter
    Moderator

    Hello Yasmine,

    What is the field type that you are using?

    #46948
    YasmineYasmine
    Participant

    Ok - but it did used to work! The AJAX has also stopped working too - also works on my other select_advanced fields, just not the post.

    Here is an example:

    
     $field = [
            'name' => __('Organisation', 'your-text-domain'),
            'id'   => 'select_an_org',
            'type' => 'post',
            'post_type'   => ['organisation'],
            'field_type'  => 'select_advanced',  
           // 'placeholder' => $placeholder,
           // 'aria-label'  => __( 'Select '.$orglabel, 'your-text-domain' ),
          /*  'query_args'  => [
                'post_status'    => 'publish',
               // 'posts_per_page' => 5,
                'tax_query'      => [
                    [
                        'taxonomy' => 'institution-category',
                        'field'    => 'term_id',
                        'terms'    => $filterterms,
                    ],
                ],
            ],*/
            'ajax'        => true, 
           // 'clone'        => true, 
           // 'max_clone' => 4,
        ];

    I disabled plugins and have tested without any of the commented out extras and still not working

    #46949
    YasmineYasmine
    Participant

    And in my message before, I was talking about

       'js_options' => [
            'minimumInputLength' => 1,
        ], 

    stopping all the posts from loading entirely but only when 'type' => 'post',. Otherwise on other select_advanced fields it works

    #46968
    PeterPeter
    Moderator

    Hello,

    If you use the field post and field type setting select_advanced, no need to enable ajax in your code because it is enabled by default. Please follow the documentation https://docs.metabox.io/fields/post/#ajax-load

    Regarding the setting js_options, I recheck this and see that it works properly on my end with any post types. Maybe the JS code is affected by a third-party plugin or a custom code on your site. You can try to deactivate all plugins except Meta Box, MB extension plugins, switch to a WordPress theme and check the issue again.

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