silverstripe-userforms/code/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 Merge branch '5.6' into 5.7 2020-11-12 15:17:31 +13:00
Recipient FIX Trim recipient email addresses before write 2020-07-14 16:41:36 +12:00
Submission FIX Fixing plain email blank file field value (#940) 2020-07-01 09:00:31 +12:00
EditableCustomRule.php Minor linting adjustment. 2020-01-14 12:28:04 +13:00
EditableFormField.php FIX unrequire fields when they become dataless (#1016) 2021-01-17 15:55:47 +13:00
UserDefinedForm.php NEW Add font-icon for site tree userform page 2019-01-14 13:39:27 +13:00