Give the gift of Drupal. All merchandise is 50% off through 2016.
I am working on a project which requires adding fields to "product" content type dynamically. That means I can not add fields to this content type from "Manage Fields" but need to use form_alter to add fields to "product_node_form".
One of the field needs to of type media selector. I am using this code:
$form['field_videofile1'] = array(
'#title' => 'File Upload',
'#type' => 'media',
When the form is rendered it is displaying uploading options and selected file is also getting uploaded to specified folder.
Now after uploading is complete, when I am submitting the form, value of this field is not coming in form state or in POST. I have investigated a little and find that there is an invisible "fid" field is generated for each media selector by "media_element_process" function. In my case name of this field should be field_videofile1_fid. But it is only "fid". As a result I am not getting value of this field in form state.
Please suggest a way out.I am really struck at this point.