I've created a checkbox field that has about 30 checkboxes in it, and following the input instructions, created the labels according to the 'one per line' rule. The checkboxes appear correctly in the edit page, but then when the data has been saved, instead of showing the corresponding labels of the checked items on the profile page, it instead shows an index number corresponding to the line in the original list. How can it be configured to show the label rather than the index number?

CommentFileSizeAuthor
#2 3.jpg55.86 KBjpcwebb
#2 1.jpg13.69 KBjpcwebb
#2 2.jpg3.32 KBjpcwebb

Comments

johnhanley’s picture

Hmmm, I'm not sure what to make of this.

Please post some screen shots of the various pages.

jpcwebb’s picture

StatusFileSize
new3.32 KB
new13.69 KB
new55.86 KB

See attached - first shot shows field editing screen with list of values, second shows the profile editing screen with checkboxes, 3rd shows the view of the profile

johnhanley’s picture

The screen shots are very helpful--thanks.

I believe this is happening because the option values are being interpreted as numeric. A proper solution should be devised, but for testing purposes would it be possible to add a frequency abbreviation after each option? This will insure the values are stored as strings and not integers.

Please try and report back.

jpcwebb’s picture

That made no difference to existing data, but editing and resetting the data for a user made it work after editing the profile checkbox labels. So your theory appears to be correct - suggest it perhaps needs a CAST statement in the sql

johnhanley’s picture

What's happening here is that numeric values are loaded into the options array starting at array element 0. For example:

array[0] = 665
array[1] = 675
array[2] = 685

...and so on.

This is the way PHP is designed.

The solution is to convert the numeric value to a string, but the options array is loaded in the core Profile module and not Profile Checkboxes.

Therefore the workaround (albeit less than ideal) is to use string values so the array key/value are the same. In your case you'll need to add a suffix of some kind to your frequency values.

jpcwebb’s picture

Thanks for following up. Agreed, the fix is beyond this module's scope, but I believe it would be helpful to nevertheless formally document this quirk in Profile Checkboxes to save future support queries/ spurious bug reports.

johnhanley’s picture

Status: Active » Closed (fixed)

Hopefully this thread will be helpful to others experiencing the same problem. Thanks again for raising awareness.

I'm closing the issue for now, but please re-open if you or someone come-up with a better workaround or outright solution.