Page MenuHomePhabricator

Validation doesn't work for multiple template mandatory fields with preloaded data
Closed, ResolvedPublic

Description

Author: mnkutster

Description:
The patch changes the SF_FormPrinter::formHTML() method making it to produce the "validate_mandatory_field" call for multiple-instanced template fields if they contain preloaded data.

Steps to reproduce

  1. Create a form with at least 1 multiple template containing at least 1 mandatory field for some parameter of the multiple template.
  2. Edit some page with the form. Add one instance of the multiple template enter some value into the mandatory field and submit the form.
  3. Edit the page with the form once more. Delete the value you have added in the previous step from the mandatory field leave the field blank and submit the form - it should not be submitted and an error message should be produced, but the form can be submitted actually. The template receives an empty parameter which might be not good.

The reason is that while the fields containing preloaded data have the ids of the form "input_<number>" regardless of whether they correspond to a multiple template instance or not validation calls for these fields are "validate_multiple_mandatory_fields(<number>)" and the "validate_multiple_mandatory_fields" function looks for fields with ids of the form "input_<instance_num>_<field_num>" being thus not able to locate the actual validation target.


Version: unspecified
Severity: normal

Attached:

Details

Reference
bz16810

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:24 PM
bzimport set Reference to bz16810.

Thanks for the patch! This was added in version 1.4.1.