By kjp on
Hi
I want to put three text fields on the same row in a form I've created
Here's The HTML output I would need to accomplish that:
<div class="form-item" id="form-item3">
<label for="edit-field-23">Titre du document:</label>
<input maxlength="30" class="form-text" name="edit[field-23]" id="edit-field-23" size="30" value="" type="text">
</div>
<div class="form-item" id="form-item2">
<label for="edit-field-21">Quantité:</label>
<input maxlength="2" class="form-text" name="edit[field-21]" id="edit-field-21" size="2" value="" type="text">
</div>
<div class="form-item" id="form-item1">
<label for="edit-field-24">Prix unitaire:</label>
<input maxlength="5" class="form-text" name="edit[field-24]" id="edit-field-24" size="5" value="" type="text">
<div class="description">Des frais d'expédition sont facturés pour tous les envois.
Les prix sont sujets à changement sans préavis. </div>
</div>Unfortunetely, default Drupal output is that :
<div class="form-item">
<label for="edit-field-23">Titre du document:</label><br>
<input maxlength="64" class="form-text" name="edit[field-23]" id="edit-field-23" size="64" value="" type="text">
</div>
<div class="form-item">
<label for="edit-field-21">Quantité:</label><br>
<input maxlength="64" class="form-text" name="edit[field-21]" id="edit-field-21" size="64" value="" type="text">
</div>
<div class="form-item">
<label for="edit-field-24">Prix unitaire:</label><br>
<input maxlength="64" class="form-text" name="edit[field-24]" id="edit-field-24" size="64" value="" type="text">
<div class="description">Des frais d'expédition sont facturés pour tous les envois.
Les prix sont sujets à changement sans préavis. </div>
</div>
I am okay with everything else. Basically, I just need to give a specific ID to three text fields and remove the br tag.
How can I get Drupal to do just that ?
Comments
The easiest way to add the
The easiest way to add the ids to the elements is probably to use the http://api.drupal.org/api/file/developer/topics/forms_api_reference.html... property to add the relevant id to the actual input element or the http://api.drupal.org/api/file/developer/topics/forms_api_reference.html... and http://api.drupal.org/api/file/developer/topics/forms_api_reference.html... properties to enclose the entire element in a div. Adding the respective id to the <div class="form-item"> is possible, but would also require use of a custom theme function.
Which theme are you using? By default drupal doesn't include a br tag after the label (see http://api.drupal.org/api/function/theme_form_element/5). Possibly the theme overrides this function with one of its own, which would be named phptemplate_form_element() or themename_form_element(), and defined in template.php.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
i will look at it thanks !
Thanks I will give this a try