Item metadata: adding a select field

Hi, I’m using ElementInput filter for changing a DC:Relation textarea to the html select list.

$list = an array of options for select

$components['input'] = get_view()->formSelect($args['input_name_stem'] . '[text]', $selected_id, array('multiple' => false), $list);

The list is being shown properly, but the button allowing to add another field is not working. There is a 500 (Internal Server Error) error within an ajax call to …/omeka/admin/elements/element-form

How should I fix that error? How to enable adding another select field?

Changing ‘multiple’ => false to true allows to select few values, but then no data is saved for that field.


You may want to check your PHP log or enable error logging. There’s likely some issue with your plugin code here that’s causing an error: that ajax call is used when we re-render the form for an element, and your ElementInput filter would be called as part of that.

If you have error display on then your browser’s inspector may also give you more information if you look at the response for that ajax call.

It was a good idea to look up into logs, I’ve found that it was an error with calling current item

this select list should be available only for one type of Items

so that:


instead of:

get_current_record('item', false), which caused

InvalidArgumentException: Invalid record passed to recordMetadata. in /omeka/application/views/helpers/Metadata.php:58