Hidden field can never be required. Skip that validation (#716)

* Hidden field can never be required. Skip that validation

* Refactor form logic editor UI with improved text and styling

- Replace UAlert with plain text description
- Update action description text
- Remove help text from select input
- Simplify note about hidden field requirements

* Add test for form logic field visibility and validation

- Implement test case for fields hidden by logic conditions
- Update AnswerFormRequest to use new FormLogicPropertyResolver method for hidden field check
- Ensure required fields are skipped when hidden by form logic

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2025-03-12 12:17:06 +05:30
committed by GitHub
parent a5162192b1
commit 7b942997ce
3 changed files with 75 additions and 2 deletions

View File

@@ -87,7 +87,10 @@ class AnswerFormRequest extends FormRequest
$data[$field['id']] = isset($tmpop['name']) ? $tmpop['name'] : $data[$field['id']];
}
}
if (FormLogicPropertyResolver::isRequired($property, $data)) {
if (
FormLogicPropertyResolver::isRequired($property, $data) &&
!FormLogicPropertyResolver::isHidden($property, $data)
) {
$rules[] = 'required';
if ($property['type'] == 'checkbox') {