I am using the Rendered view field (title) as the display text for a webform select list. The title is one of those fields and unfortunately it is displayed as plain text, resulting in some characters getting displayed as HTML codes. For example "Jon's Book Review" would be displayed as "Jon's Book Review", which is unacceptable.

This problem does not happen if I use just the Node title as the display text, but that is not an option because I need to include additional fields. It is also specific to the choice of Listbox; the default use of checkboxes means the titles get rendered properly.

Can anyone point me in the right direction? Thanks.

Comments

stuwat’s picture

After taking a look at the source code for the webform containing the problem, I see that the ampersand used in the HTML code for the apostrophe, is being rewritten as "&". The HTML for the apostrophe symbol therefore doesn't work, because it becomes "'" when it should be "'".

This issue may be of relevance here: http://drupal.org/node/813924.

Once again, the problem only occurs with the use of listbox and rendered view fields.

stuwat’s picture

Issue summary: View changes

New information

awaller98’s picture

Issue summary: View changes

I realize this is an old thread, but I ran into this issue as well. I can't guarantee this solution doesn't cause problems elsewhere (nor have I checked), but it does correct HTML special chars appearing in Rendered view field (title) as the display text for a webform select list.

I don't know the proper way to submit a patch, but here is what worked for me:

In viewselect.inc, just change:

816  function theme_webform_viewselect_option_text($rendered, $row, $field) {
817    if ($rendered) {
818      return html_entity_decode(_webform_filter_xss($row['rendered']));
819    } 
820    else {
821      return html_entity_decode(_webform_filter_xss($row['title']));
822    }
823   }

TO

816 function theme_webform_viewselect_option_text($rendered, $row, $field) {
817  if ($rendered) {
818    return html_entity_decode(_webform_filter_xss($row['rendered']), ENT_QUOTES);
819  } 
820  else {
821    return html_entity_decode(_webform_filter_xss($row['title']), ENT_QUOTES);
822  }
823 }

I'm a bit noobish, so if anyone has time to run it through the paces to make sure it doesn't screw anything up... please do, and let me know if there is a better way to do this.

awaller98’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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