2

I want to set anyone field is required from two fields [UiComponent]

enter image description here

for example, either text field or Image anyone needs to a required field otherwise can not save.

1 Answer 1

0

I manage this validation by trick while saving data

In save controller you should check condition for blank data

if(!$Data['textfield'] && !isset($Data['image'])){
          $this->messageManager->addNoticeMessage(
                    __(
                        'please add image or text.'
                    )
                );
        $this->_redirect('*/*/add');
        return;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.