Download & Extend

Remove colon from label

Project:Webform
Version:6.x-2.1.3
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

I have questions on my form that end in a questions mark, however it seems to automatically add a colon at the end of every label, so each of my questions ends in "?:"

How do I stop it from adding the colon?

Thank you for your help.

Comments

#7

This method does not work for me either, to remove colons from the field labels in webforms

I hacked the includes/form.inc code to remove the colons, removing the colons from $t('!title: to make them $t('!title in function theme_form_element lines 2202 and 2205, ( http://drupal.org/node/376345 ) but of course that was lost upgrading to core 6.11

so I devised a DHTML method - paste this script into the webform body

<script type="text/javascript">
function nocolons(){
doclabs = new Array;
doclabs = document.getElementsByTagName('label');
if (doclabs.length) {
  for (i=0; i<doclabs.length; i++ ){
    labtext = doclabs[i].innerHTML;
    if (labtext.indexOf(":")) {
      striptext = labtext.substr(0, labtext.indexOf(":")) + labtext.substr(labtext.indexOf(":")+1, labtext.length);
      doclabs[i].innerHTML = striptext;
    }
  }
}
}
onload=nocolons;
</script>

I suppose this snippet could also go in a theme file, probably page.tpl.php

I only have one webform, so it is more efficient for me to put the code in the webform body

nobody click here