I have a content type with a multi value text field. It renders as the table with sticky headers, draggable lines and "add more" button. I just want a text field and a link "add more" below, so the display fits better into the form and is not that ostentatious.

Isn't there a simple widget or do I have to do a form alter or other measures?


I tried

function MYMODULE_field_widget_text_textfield_form_alter(&$element, &$form_state, $context) { 
if ($element['#field_name'] == 'field_rechner') { 
  $element['value']['#type'] = 'textarea';


and that works; so how do I replace the widget itself?


  1. For a css only solution - I am not sure if this can be achieved : How can I keep the input tag but remove(hide) the stuff outside??

the html is the following:

<div class="field-type-text field-name-field-rechner field-widget-text-textfield form-wrapper" id="edit-field-rechner"><div id="field-rechner-add-more-wrapper"><div class="form-item"><table id="field-rechner-values" class="field-multiple-table sticky-enabled">
 <thead><tr><th colspan="2" class="field-label"><label>Rechner </label></th><th>Reihenfolge</th> </tr></thead>
 <tr class="draggable odd"><td class="field-multiple-drag"></td><td><div class="form-item form-type-textfield form-item-field-rechner-und-0-value">
  <input class="text-full form-text" type="text" id="edit-field-rechner-und-0-value" name="field_rechner[und][0][value]" value="" size="20" maxlength="20" />
</td><td class="delta-order"><div class="form-item form-type-select form-item-field-rechner-und-0--weight">
  <label class="element-invisible" for="edit-field-rechner-und-0-weight">Weight for row 1 </label>
 <select class="field_rechner-delta-order form-select" id="edit-field-rechner-und-0-weight" name="field_rechner[und][0][_weight]"><option value="0" selected="selected">0</option></select>
</td> </tr>
<div class="clearfix"><input class="field-add-more-submit form-submit" type="submit" id="edit-field-rechner-und-add-more" name="field_rechner_add_more" value="Weiteres Element hinzufügen" /></div>
  • I found that but not sure how to use it : dropbucket.org/node/1265 – groovehunter Apr 20 '15 at 11:38
  • simple css to hide and manipulate the parts of the form you want hidden is quick and easy without requiring another module or a form_alter – Geoff Apr 20 '15 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.