Add prefix and suffix to textfield component
BrianJubal - June 4, 2008 - 21:27
| Project: | Webform |
| Version: | 5.x-2.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I've been searching for a few days now but can't find something like what I'm looking for. My boss would like me to add a suffix like lbs. or machines to the webform that is inline and right after the textfield of one of the webform components, so that it would look something like:
Weight:
|_TEXTFIELD_| lbs.
This is the weight of the object.
I am assuming the easiest way to do this would be to use hook_form_alter and add a #field_prefix to the form, but if there is a better way, please let me know! Otherwise, please help me find how to access and alter the individual components.

#1
A form_alter or theming is the easiest approach currently. I'm open to accepting a patch for adding #field_prefix and #field_suffix options to the textfield component also, which would make this much easier for other users.
#2
So you know, a patch that does this very thing is in my pile of things to do. I hope I can have one pretty soon. I've never built a true patch, so I'll need a little grace for my first attempt. :)
#3
Again, first attempt at creating a patch. Let me know what I can do better or if I overlooked something.
#4
I grabbed 5.x-2.0 (the latest) before I created this patch.
#5
#6
Thanks! I committed this with the addition of including the prefix in sent e-mails. We could probably include it also in analysis and table views, but we can save that for a later time.
Here's the commit: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/webform/com...
#7
Updating title for posterity.
#8
Automatically closed -- issue fixed for two weeks with no activity.