1

I have a widget for a field as shown below:

widget

I would like to make the text field ('script_paths') an unlimited value so that the user can add as many as they like. Is there a way to do this? Maybe there is a property I add in my code below:

function mango_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) { $field_name = $instance['field_name']; $required = $element['#required']; $item =& $items[$delta]; $element += array( '#type' => 'fieldset', ); $element['enabled'] = array( '#title' => t('Enabled'), '#type' => 'checkbox', '#default_value' => isset($item['enabled']) ? $item['enbled'] : '', ); $element['script_paths'] = array( '#title' => t('Script Paths'), '#type' => 'textfield', '#default_value' => isset($item['script_paths']) ? $item['script_paths'] : '', ); return $element; } 

1 Answer 1

2

I would think that there would be a property as well but I can't think of one for text fields. I know that you can use field collections though.

Edit: I was mistaken Field Collections will not work for custom forms, however This tutorial worked for me.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.