Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Radio button aggressively resets to global default in edit field


dwdutch
Participant

@dwdutch

I’m refreshing this thread because I’m experiencing this same problem in my blog but I’ve not found a solution anywhere else in the forum. I believe I’ve tracked the problem to its source in bp-xprofile-templatetags.php but need a little help to resolve it.

To recreate this issue, I have a 5-value radio-button sequence with the default-value being the 3rd value in the sequence and the assigned value being the 1st in the sequence. As a result, during the for-loop in the ‘radio’ switch case, TWO values are marked as being “checked” but (since it’s presented as radio-buttons) only the last in the sequence is reported as the activated button.

The problem occurs because the if-statement that decides which field is “checked” is a series of ORs — this is correct for a checkbox field-type that can have multiple values. but for radio field-type, it should be either the set-value OR the default-value but not both.

I’m still just a little too new with the code-base to be confident of what should be the correct fix but, having described the problem, I’m sure @jeffsayre or another BP-expert can propose a straight-forward correction.

In case my description this doesn’t make sense, below is the $html string that is generated from the bp_get_the_profile_field_options() call on a radio-button field type:

Skip to toolbar