Answers.Body: <p>John - There's an existing pattern for simply add the markup to the template for cases like this, and I think it's fine for this situation. So in Register.tpl, just add this markup after the label:</p>
  
  <pre><code>&lt;span class="crm-marker" title="{ts}This field is required.{/ts}"&gt;*&lt;/span&gt;
  </code></pre>
  
  <p>Note that there was evidently some spots where this technique was used / but then removed in that file (see line 47). I think we can remove that {capture} statement at this point and just put the markup where it's needed.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-04T10:12:57.637Z
Answers.Text: Created an issue and PR here: https://issues.civicrm.org/jira/browse/CRM-16624
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-22T23:19:52.243Z
Answers.LastActivityDate: 2015-05-22T23:19:52.243Z
Answers.UserDisplayName: Dave Greenberg
Body: <p>From a user perspective, the 'How many people are you registering?' input, on the event registration form for multiple participants, is a required field. Therefore, it should have the red asterisk for continuity.</p>
  
  <p>However, we can't just add the 'required' formRule to the element, because behind the scenes a '1' is a value of nothing (ie: no additional participants).</p>
  
  <p>So what's the easiest way of adding the 'required' class to the element, without adding the form rule itself? It would be great to push this back to core, rather than us just overriding it in our CSS, even though it is a <em>super-trivial</em> improvement.</p>
  
Tags: <civievent><forms><usability>
Title: How to add a class to a form element in buildQuickForm?
ThreadText: # How to add a class to a form element in buildQuickForm?
  
  (Asked by: username_0 on 2015-05-22)
  
  From a user perspective, the 'How many people are you registering?' input, on the event registration form for multiple participants, is a required field. Therefore, it should have the red asterisk for continuity.
  
  However, we can't just add the 'required' formRule to the element, because behind the scenes a '1' is a value of nothing (ie: no additional participants).
  
  So what's the easiest way of adding the 'required' class to the element, without adding the form rule itself? It would be great to push this back to core, rather than us just overriding it in our CSS, even though it is a *super-trivial* improvement.
  
  **Tags:** civievent, forms, usability
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-22. Score: 3 | Accepted answer
  
  username_0 - There's an existing pattern for simply add the markup to the template for cases like this, and I think it's fine for this situation. So in Register.tpl, just add this markup after the label:
  *
  
  Note that there was evidently some spots where this technique was used / but then removed in that file (see line 47). I think we can remove that {capture} statement at this point and just put the markup where it's needed.
  
  > **Comments:**
  > **username_0**: Created an issue and PR here: https://issues.civicrm.org/jira/browse/CRM-16624  
  
  ---
  
  