I am building a webform and would like to number each question (webform component). What is the automated way to do this (rather than number the component label text)?

Webform 3 (but may move to Webform 4 later).

I've searched a bit for this, but get results about phone number fields :/

Thanks for your time.


I have clarified the question to state that I want to visually number the components, the numbers themselves would not be related to the component id, rather, they would be for the benefit of the user. It would be used to number the questions e.g.:

  1. Question
  2. Question


  • Why is this important? The component id cant be customized i believe – Alex Jul 27 '15 at 16:01
  • It's important because the webform that I am building is a series of questions and I'd like to number them. The numbers would be visible to the user. – therobyouknow Jul 27 '15 at 16:17

You could use an entirely front-end solution with CSS counters: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Counters

I believe components are siblings of each other which would make this quite easy.

| improve this answer | |
  • +1 that sounds like a great solution. I'll explore more and follow up. Alternatively I'd consider writing a hook using the webform api. Thanks. – therobyouknow Jul 27 '15 at 16:25
  • 1
    This seems like a presentational problem more than a back-end problem. I'd always lean towards CSS solutions for these kind of issues. – Sam152 Jul 28 '15 at 6:24

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.