silverstripe-userforms/tests/Model
Dylan Wagstaff c0a30f1b6a
FIX unrequire fields when they become dataless (#1016)
* FIX unrequire fields when they become dataless

When fields that collect input data are changed in configuration via the
CMS to become fields that no longer collect input data (e.g. TextField
-> HTML Block), submitting the resulting form results in a fatal error,
server 500 response, etc. due to trying to check if a field without data
(ever) has data in it.

To circumvent this we can set the required state to false if the field
is being converted to one that does not collect data (which FormField
API conveniently provides a check for).

* Move parent::onBeforeWrite() to top of function

Co-authored-by: Steve Boyd <emteknetnz@gmail.com>
2021-01-17 15:55:47 +13:00
..
EditableFormField FIX Show custom validation message for checkbox and radio groups 2020-07-21 17:30:55 +12:00
Recipient FIX Trim recipient email addresses before write 2020-07-14 16:41:36 +12:00
EditableCustomRuleTest.php Patch and reorganise some test 2020-01-13 12:15:34 +13:00
EditableCustomRuleTest.yml FIX Use correct class names in EditableCustomRuleTest fixtures 2017-08-22 16:40:17 +12:00
EditableFormFieldTest.php FIX unrequire fields when they become dataless (#1016) 2021-01-17 15:55:47 +13:00
EditableFormFieldTest.yml NEW Add folder confirmation modal when adding a new `EditableFileField` to a userform. (#972) 2020-06-10 16:59:01 +12:00
UserDefinedFormTest.php Merge branch '5.5' into 5 2020-05-27 13:41:51 +12:00