This is working great for 95% of my forms, but I did encounter a small problem with one form today. The option list values get chopped off at quotation marks. You should see the problem if you try the following list of options and then turn on the Options Element module:

aasaf|<a target="_blank" href="/scholarships/aasaf-scholarship">AASAF Scholarship</a>
air_force_rotc|<a target="_blank" href="/scholarships/air-force-rotc-scholarships">Air Force ROTC Scholarships</a>
apsu_national|<a target="_blank" href="/scholarships/apsu-national-alumni-association-scholarships">APSU National Alumni Association Scholarships</a>
apsunaa_reunion|<a target="_blank" href="/scholarships/apsunaa-reunion-and-past-presidents-scholarship">APSUNAA Reunion and Past Presidents Scholarship</a>
beta_sigma_phi1|<a target="_blank" href="/scholarships/beta-sigma-phi-laureate-eta-chapter-scholarship">Beta Sigma Phi (Laureate Eta Chapter) Scholarship</a>

For the time being, I've switched all of these double-quotes to singles and that's fixed it. I just thought I'd mention that I spotted this though.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Excellent, thanks for the report I'll take a look next time I'm updating Options Element.

Cyberwolf’s picture

Subscribing. Same problem here.

quicksketch’s picture

Status: Active » Fixed
FileSize
2.43 KB

I've committed this patch which corrects the problem.

HorsePunchKid’s picture

Status: Fixed » Needs review
FileSize
561 bytes

I had the same issue, I'm pretty sure, and fixed it in a different way (a check_plain($value) in _form_options_to_text()). The fact that our patches seem to be totally unrelated makes me worry that the issue is not actually fixed completely by either.

quicksketch’s picture

@HorsePunchKid: Could you try out the 1.5 version of Options Element and see if you still have a problem? I think your solution would cause an issue with double-encoding if you edited the same field multiple times, because each time _form_options_to_text() is called you encode the values again without ever decoding them. I think your solution may indeed solve the same issue in one way because it encodes quotes so that the HTML attributes don't get mangled (which is what my patch did also, but in a different way), but if you were to have something like an ampersand in your value, it would end up getting double-encoded after editing the field a couple of times.

quicksketch’s picture

Status: Needs review » Fixed

@HorsePunchKid: I did *not* commit your patch because I think this problem is already fixed, plus the new patch would probably have the problem I described in #5. Please reopen if you can confirm this issue is still a problem in 1.5.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.