I'm using my own templates to modify forms, i.e. user registration form. In my custom template, I call
drupal_render($form['field_email']); to get output for a text input used for taking user's Email.
However, this function returns so many outputs (including a Label which definitely I don't want, and a lot of divs) that break my design. What I require is a single
<input name = "appropriate-name" /> but I'm getting:
<div class="field-type-email field-name-field-user-email field-widget-email-textfield form-wrapper" id="edit-field-user-email"><div id="field-user-email-add-more-wrapper"><div class="text-full-wrapper"><div class="form-item form-type-textfield form-item-field-user-email-und-0-email"> <label for="edit-field-user-email-und-0-email">Email <span class="form-required" title="This field is required.">*</span></label> <input type="text" id="edit-field-user-email-und-0-email" name="field_user_email[und][email]" value="" size="60" maxlength="128" class="form-text required" />
A lot of HTML!
Is there a way to get minimum HTML required for a form input field to work properly?
Perhaps, I may end up with editing the
#theme property for this field, to specify a custom theme function. But That's a lot of work to do, I think. Besides, I have many other fields for which I may need to write custom theme functions to get simple HTML for the input. Is there a quick way to get minimum HTML for a form field?