0

I know you can add colon in field.tpl.php for site wide content type node fields, but looks like it's not webform field related.

And webform doesn't have any webform-field.tpl.php type of templates to edit?

By default, webform fields has no colons e.g. Full Name label needs to be Full Name:.

I know I can add that with CSS, e.g.

.form-item label:after {
  content: ":";
}

But this won't work because I need colons to be printed in subnmitted email template too.

And emails dont support ::after ::before CSS I think, or there is complication with various web email providers, etc.

I know you can add a manually : when creating the label name and like that for every field (but its tiring if multipage long forms), but that's impractical for various reasons like e.g. https://www.drupal.org/node/1922550

0

With D7 webforms, you should be able to access the parts of the webform (rendered within webform-form.tpl.php) within a form alter:

function mymodule_form_alter( &$form, &$form_state, $form_id ) {}

If you have the devel module enabled, you can use it to print out the variables within the $form['submitted'] array - for example, to edit the title of a form component, you would use:

$form['submitted']['my_form_component']['#title'] = 'My new title';

To add a colon to the end of each component's attribute (i.e. to add a colon at the end of the #title attribute) you could set

$form['submitted']['my_form_component']['#title'] = $form['submitted']['my_form_component']['#title'] . ":";

If you use a variable instead of the specific 'my_form_component' name, you can set the form_alter function to loop over and add the ":" to the end of all component titles.

Small example here: https://www.drupal.org/node/1558246

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.