Closed claar closed 8 years ago
@claar the error message is correct. The "Under-represented Minority" number cannot be larger than the total attendees.
Are you a developer for one of the EPSCoR jurisdictions?
You're right that the validation is working correctly, but the error message is missing the field name after "for", and field highlighting is not working. This will lead to user confusion as to which field has the error.
It should read something like: "The value for Faculty -- Under-represented Minority must be less than the total.", and it should highlight the affected field.
I don't use ERCore myself; I'm a web developer with Piestar. We offer a product for tracking EPSCoR data, and I noticed this bug when exploring ERCore's capabilities to create https://www.piestar.com/piestar-vs-ercore/. Just being friendly and helpful!
I looked at this while testing making all of the attendee fields required. I see what he’s talking about; there are a couple of small errors in the code.
In includes/node_logic.inc, starting at line 303, existing code is:
if ($urm > $total){
$urmFieldData = field_info_instance('node', 'field_er_'.$type.'_urm', $node->type);
form_set_error('field_er_'.$type.'_urm][i][value', "The values for <u>{$urmFieldData->label}</u> must be less than the total. See: <u>$categoryLabel</u> section.");
}
but it should be:
if ($urm > $total){
$urmFieldData = field_info_instance('node', 'field_er_'.$type.'_urm', $node->type);
form_set_error('field_er_' . $type . '_urm', "The values for <u>{$urmFieldData['label']}</u> must be less than the total. See: <u>$categoryLabel</u> section.");
}
(change $urmFieldData->label
to $urmFieldData['label']
and [i]
to [0]
)
After making this change, the error message displays the field label, and the field with the error is outlined in red as usual.
Oops ignore the [i] to [0] comment; that part just goes away completely in the code.
I updated ERCore to include the label in error on the 3.2-dev branch here: https://github.com/EPSCoR/ERCore-3.1/commit/ef79f5c30a665b16ac421aead07bbcd2f00ad2c6
If an "Under-represented Minority" number is entered that's larger than the total attendees, this confusing error message is shown. Also, the field with the error is not highlighted.