By ooXei1sh on
Hi, Is it possible to wrap a form input inside it's label tag? I'd like to format the markup like this:
<div class="form-item form-type-textfield form-item-FirstName">
<label for="edit-firstname">First Name
<span class="form-required" title="This field is required.">*</span>
<input type="text" id="edit-firstname" name="FirstName" value="" size="25" maxlength="37" class="form-text required" /></label>
</div>
With the label closing tag is after the end of the input.
I think I'll need to override the 'theme_form_element_label' function in the 'includes/form.inc' but I'm not sure how to go about it.
Comments
Got it: <?php/** * Implements
Got it:
Above code won't work properly...
Ok, so the above code doesn't account for the form rebuild... thus if a radio was selected it will not be selected if the form needs to rebuild to show errors (like leaving a required field blank) but I found this which led me in the right direction:
http://www.encodez.com/blog/how-to-theme-radio-drupal.html
This is what I ended up going with: