By jaypan on
I have created a form using the form api (drupal 6.x), and after the title for each of the form elements, it adds a colon. For example, I am calling a form element like this:
$form['questionnaire']['howmuchmoney'] = array
(
'#type' => 'select',
'#title' => t('How much money do you have allocated?'),
'#required' => TRUE,
'#options' => array
(
'$500 OR LESS' => '$500 OR LESS',
// etc
)
);And the title appears like this on the page:
How much money do you have allocated?:
This looks strange having a colon and a question mark. Does anybody know how to remove this question mark? It seems that drupal is adding extra unwanted text to my form, and I'm hoping there is an override for it!
Comments
bump
bump
Contact me to contract me for D7 -> D10/11 migrations.
The colon comes from
The colon comes from theme_form_element() which you can override.
Thank you sir!
Thank you sir!
Edit: I was able to override this and get rid of the colons. Thanks again!
Contact me to contract me for D7 -> D10/11 migrations.
what did you do to remove
what did you do to remove the :
I.E how did you override this ?
reasonably flexible way
I am late to the party, but I had the same problem.
I not only wanted to remove the : after ?, but also in other spots where it did not make sense.
In those cases I add a ~ char to the end of the title (using a hook_form_alter() if necessary) and then remove the ~ later when I strip the : in the theme function.
Here is my solution (stylistic criticism appreciated):
hide : after '?'
If you just want to hide the colon after the question mark, this simple code will do that (replaces the switch(TRUE) statement in the code above):
http://drupal.org/project/no_
http://drupal.org/project/no_colons
This module works for almost all titles (views, CCK, form API, etc...).