Custom Fields
Re-Envisioned
Support General Required Validation Not Working

  • Creator
    Topic
  • #19605
    Resolved ossama saeed
    Participant

    Hi Guys,
    I am trying to use the required validation, but it did`t work. it only show the red * . can you help me ?

    $meta_boxes[] = array(
            'title'      => 'Country Code',
            'taxonomies' => 'country-code',
            'fields' => array(
                array(
                    'name'  => 'dial-code',
                    'id'    => 'dial-code',
                    'type'  => 'number',
                    'desc'  => 'enter the country dial code e.g. +20',
                    'required'  => true,
                )
            ),
        );
    

    Thanks in advanced,

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #19612
    Long Nguyen
    Moderator

    Hi,

    Could you please update the latest version of Meta Box plugin to v5.3.0 and MB Term Meta to v1.2.9 then check the issue again?

    Here is my sample code

    add_filter( 'rwmb_meta_boxes', 'add_field_taxonomy' );
    function add_field_taxonomy( $meta_boxes ) {
        $prefix = '';
        $meta_boxes[] = array (
            'title' => esc_html__( 'Taxonomy field', 'text-domain' ),
            'id' => 'taxonomy-field',
            'fields' => array(
                array (
                    'id' => $prefix . 'text_m0ijcp97ay',
                    'type' => 'text',
                    'name' => esc_html__( 'Text Field1', 'text-domain' ),
                    'required' => 1,
                ),
            ),
            'taxonomies' => 'category',
        );
        return $meta_boxes;
    }

    and it works as well on the post category settings page, see my screenshot https://cl.ly/56fc0ebfce18

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.