1

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.

Update

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

etc.

2
  • Why is this important? The component id cant be customized i believe
    – Alex
    Commented Jul 27, 2015 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. Commented Jul 27, 2015 at 16:17

1 Answer 1

2

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.

2
  • +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. Commented Jul 27, 2015 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.
    – Sam Becker
    Commented Jul 28, 2015 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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