View Issue Details

IDProjectCategoryView StatusLast Update
0035466mantisbtcustom fieldspublic2025-06-29 13:09
Reportervicsuarez Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version2.27.0 
Summary0035466: Mandatory date custom fields not being validated by HTML5 browsers
Description

date_api.php, in print_date_selection_set function, generates HTML for date custom fields printing three \<select> elements (year, month and day). If the custom field is marked as mandatory then print_date_selection_set function adds HTML5 "required" attribute to \<select> elements.

But that function sets the first \<option> element to "0" value in this fragment of code:

    if( $p_allow_blank == true ) {
        $t_blank_line = '<option value="0"></option>';
    }

Browsers understand that "0" is not an empty value so don't show any warning and allow the submitting of the form.

HTML5 validation should work modifying previous fragment for setting intital value to empty string instead of "0" (gpc_get_custom_field function in gpc_api.php already defaults to zero on empty values):

    if( $p_allow_blank == true ) {
        $t_blank_line = '<option value=""></option>';
    }
TagsNo tags attached.

Activities

There are no notes attached to this issue.