- π¬π§United Kingdom joachim
Updating the version.
And why was this changed from a bug? The form system is swallowing errors, and that results in bad UX. That seems like a bug to me.
Once form_set_error has received an error on component 'foo', subsequent errors set by validation code are ignored, like this:
if (isset($name) && !isset($form[$name])) {
This means that the user can potentially fix the problem, resubmit, only to get another warning.
User says: "Well why didn't you tell me about that first time around? FAIL!"
Here is use case code: the form is a textarea where each line is a file that should exist:
$sites = array_map('trim', explode("\n", $form_values['values']['holding_sites']));
foreach ($sites as $conf_dir) {
if (!file_exists('sites/' . $conf_dir)) {
form_set_error('holding_sites', t('The directory @dir does not exist.', array('@dir' => check_plain('sites/' . $conf_dir))));
}
}
Obviously I can refactor this to check in the loop and set the form error with all failed folders outside the loop -- but this won't cover cases where several modules might want to say something about the same element.
Needs work
11.0 π₯
Last updated
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Updating the version.
And why was this changed from a bug? The form system is swallowing errors, and that results in bad UX. That seems like a bug to me.