Custom Fields
Re-Envisioned
Support Meta Box Conditional Logic bugs: using two fields and field with required attribute

  • Creator
    Topic
  • #19384
    Resolved Jefferson
    Participant

    Hi!

    How are you doing in this quarantine period? I hope well!

    I have two cases in which I am encountering problems using the logical conditions:

    1. I have two fields that need to be displayed using the same logic. However, when I apply this to the code, the logic is not respected and all fields that have some condition are shown, even when they shouldn’t be.
    2. I have a field where I added the required attribute. But it turns out that by default this field is not displayed and needs a logical condition to be shown. When this condition occurs, the field is shown, however I can save the post even if the field has not been filled in, which should not happen since it has the required attribute.

    MY CODE:

    array(
            'visible'    => array('status', 'in', array('scheduled','realized','review')),
            'name'       => 'Data da Consulta',
            'id'         => 'scheduled_to',
            'type'       => 'datetime',
            'attributes'       => array(
              'required'       => true,
            ),
            'js_options' => array(
                'stepMinute'      => 15,
                'showTimepicker'  => true,
                'controlType'     => 'select',
                'showButtonPanel' => false,
                'oneLine'         => true,
            ),
            'inline'     => false,
            'timestamp'  => false,
            'tooltip'             => array(
                        'icon'            => 'help',
                        'content'         => esc_html__('Se for o caso, informe a data para a qual a consulta com o cliente foi agendada.', 'mercadoterra'),
                        'position'        => 'right',
            ),
          ),
          array(
            'visible'    => array('status', 'in', array('scheduled','realized','review')),
            'name'       => 'Informe o local da consulta',
            'id'         => 'location',
            'type'       => 'textarea',
            'tooltip'             => array(
                        'icon'            => 'help',
                        'content'         => esc_html__('Informe o endereço de forma detalhada onde será realizada a consulta. Caso seja na casa do cliente, informe "Em domicílio"', 'mercadoterra'),
                        'position'        => 'right',
            ),
          ),
          array(
            'visible'    => array('status', '=', 'declined'),
            'name'       => 'Informe o motivo da desistência',
            'id'         => 'declined_by',
            'type'       => 'textarea',
            'tooltip'             => array(
                        'icon'            => 'help',
                        'content'         => esc_html__('O motivo não será divulgado para o cliente e servirá para que possamos melhorar nosso serviço.', 'mercadoterra'),
                        'position'        => 'right',
            ),
          ),
Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #19395
    Long Nguyen
    Moderator

    Hi,

    The problem happens because of the double quote in the content of tooltip "Em domicílio". Please update the new version of MB Conditional Logic to v1.6.12 then check it again.

    Thank you.

    #19397
    Jefferson
    Participant

    Hey Long!

    Thanks for response. Works fine!

    Now, I’m sending a screenshot of my metabox. When the fiedl are hidden a large vertical space are created because the style hidden is applied to rwmb-field and not to rwmb-row.

    I believe that a feature shouldn’t change the UI look that way. What do you think?

    null

    #19405
    Long Nguyen
    Moderator

    Hi,

    There is margin-bottom 12px of each row, see my screenshot https://cl.ly/0b63d60d6edb

    Thank you for your idea, I will discuss with the developer team to improve this case.

    Have a good day.

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