Bug in birthdate type
-
I think I’ve found an annoying bug in the birthdate type as defined in Bxcft_Field_Type_Birthdate.php .
I have a profile field which is a single select type with several numeric fields that are years, e.g. 2000, 2001.
When editing this field (
users.php?page=bp-profile-setup&mode=edit_field&group_id=1&field_id=1234
), when adding a new item and clicking Update, Chrome issues this error in the console: “users.php?page=bp-profile-setup&mode=edit_field&group_id=1&field_id=1234:1 An invalid form control with name='birthdate_option[2]' is not focusable.
”Note that this error is from the browser, not from javscript.
The error appears to be happening because the birthdate form control tries to set a default value for itself, which for some reason it takes from the existing options for the select, without checking what they might be. It also has validation on the number input type and so e.g. in my case it generates this code:
Minimum age: <input type="number" name="birthdate_option[2]" id="birthdate_option2" min="1" max="100" value="1999" />
Even though it’s hidden, chrome tries to validate this field and fails, so the form can’t be submitted.
Hacking Bxcft_Field_Type_Birthdate.php at line 159 to e.g. not render a default value solves the problem.
I would submit a patch, but it’s hard for me to understand the desired behaviour here.
- The topic ‘Bug in birthdate type’ is closed to new replies.