[MGNLFORM-359] Mandatory property not working on formFile Created: 23/Dec/21  Updated: 18/Oct/22  Resolved: 13/May/22

Status: Closed
Project: Magnolia Form Module
Component/s: validation
Affects Version/s: 2.7.3
Fix Version/s: 2.7.6

Type: Bug Priority: Neutral
Reporter: Roberto Gaona Assignee: Yen Lac Tue
Resolution: Fixed Votes: 3
Labels: VN-Analysis, VN-Implementation
Σ Remaining Estimate: 0d Remaining Estimate: 0d
Σ Time Spent: 4.25d Time Spent: 4d 1.5h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: GIF File formFile_requiredField.gif     Zip Archive my-module.zip     PNG File null_value_mandatoryField.png    
Issue Links:
causality
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLFORM-377 Development Sub-task Completed Yen Lac Tue  
MGNLFORM-378 piQA Sub-task Completed Thuy To  
MGNLFORM-379 QA Sub-task Completed Jesus Alonso  
MGNLFORM-380 Verify documentation Documentation Task Completed Adrian Brooks  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: AuthorX Support
Sprint: AuthX 9
Story Points: 2
Team: AuthorX

 Description   

Steps to reproduce

  1. Configure the formFile component to have a mandatory boolean property. Like formEdit.
  2. Add the formFile component to any formulary with the new property set to true
  3. Trying to submit the form, either with a file attached or not, will result on an error taking place.

Expected results

The form can't be submitted only if the file is not attached.

Actual results

The form can't be submitted wether the file is attached or not.

Workaround

Development notes

The check seems to take place here:

https://git.magnolia-cms.com/projects/MODULES/repos/form/browse/magnolia-form/src/main/java/info/magnolia/module/form/templates/components/DefaultFormDataBinder.java#152

The validation doesn't take into account that StringUtils.isEmpty will return null if the field is an attachment, resulting on it always returning an error.


Generated at Mon Feb 12 05:39:26 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.