Support Forum » User Profile

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Select Advanced does not execute callback #31053
    FedeFede
    Participant

    Thanks, I finally solved it by using the normalize filter of the field:

    add_filter('rwmb_normalize_languages_field', function($field) {
        $field['options'] = ks_get_languages();
        return $field;
    });
    in reply to: Remote Validation Example? #30665
    FedeFede
    Participant

    I expose my complete casuistry because it still does not work:

    I have a custom post type with no editor support.
    https://imgur.com/a/RnZBC4c
    Associated to that CPT I have a group of fields, one of the fields is a WYSIWYG editor with the ID 'post_content'.
    https://imgur.com/a/3HPGWA2
    In the code of a plugin I have the AJAX call to action:

    add_action('wp_ajax_check_descripcion', 'ks_validate_descripcion');
    
    function ks_validate_descripcion()
        {
            echo 'false';
            die();
        }
    

    When I submit the frontend form, the validation occurs and I can see the error message set in the MB Builder 'description failure', but the form submission continues its execution and ends up saving the post.

    If the CPT doesn't have editor support, I'm not using the block editor, am I?

    How can I make the validation stop?

    Thanks.

    in reply to: Remote Validation Example? #30649
    FedeFede
    Participant

    I have set the full URL in the callback and it works, but only partially.

    When I submit the form, the error message indicated in the MB Builder below the field appears briefly, but the validation continues and the post is saved.

    What am I doing wrong, how do I stop the validation when I reach this field?

    in reply to: Remote Validation Example? #30625
    FedeFede
    Participant

    Is it possible to use remote validation from the MB Builder interface? Which URL should I specify?
    I'm trying this way and I can't get it to work:

    MB Builder

    add_action('wp_ajax_check_descripcion', 'ks_validate_descripcion');
    function ks_validate_descripcion()
        {
            echo 'false';
            die();
        }
    FedeFede
    Participant

    This is the code I am using and it does not work to customize the editor for the fake content field:

    public function ks_editor_trabajo_realizado($meta_boxes)
        {
            $post_id = filter_input(INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT);
            $post_content = get_post_field('post_content', $post_id);
    
            $meta_boxes[] = [
                'title'      => 'Descripción del trabajo',
                'post_types' => 'trabajo-realizado',
                'fields'     => [
                    [
                        'type' => 'wysiwyg',
                        'id'   => 'content',
                        'name' => 'Descripción',
                        'std'  => $post_content,
                        'save_field' => false,
                        'options' => [
                            'textarea_rows'   => 3,
                            'media_buttons'    => false,
                            'teeny' => false,
                            'quicktags' => false,
                            'tinymce' => [
                                'media_buttons'    => false,
                            ]
                        ]
                    ],
                ],
            ];
    
            return $meta_boxes;
        }

    Any help please?

    FedeFede
    Participant

    I can't edit the text above (there were mixed references). This is the other code I have tried:

    https://pastebin.com/F4QWtfWm

Viewing 6 posts - 1 through 6 (of 6 total)