Unique ID for File Fields inside a List Field

2 views
Skip to first unread message

babysteps

unread,
Dec 10, 2010, 12:48:25 PM12/10/10
to inputex
I have a Form with a List Field and inside of each list entry is a
file field. In order for my backend script to process the files
($_FILES) it needs a unique id for each File Field. For File Fields
in a form I normally just add the id when creating the field, but the
List entries are multiple and are generated when data is received.

How can I create a unique id for each file field and pass that id
along with the form submission so that I know which File Field belongs
to which List entry?

In the example below, 'file_act' works fine because I assign it an ID
when the form is created, so on the backend I know which file to
process. 'file_gas' is in a List Field, so I could potentially have
many 'file_gas' fields submitted with the form. How can I identify
these files on the backend?

fields: [
{ name: 'id_act', type: 'hidden' },
{ name: 'file_act', id: 'file_act', type: 'upload', label: 'Product
Image', description: 'PNG, JPG, GIF / Max File Size: 10MB' },
{ name: 'assets', type:'list', label:'Assets', sortable:true,
useButtons:true,
elementType: {
name: 'assetFile', type: 'combine',
separators: [false,"<div class='inputEx-fieldSpacer'></
div>",false],
fields: [
{ name: 'name_gas', label: 'Name', maxLength:50 },
{ name: 'file_gas', type: 'upload', label: 'File', description:
'Max File Size: 10MB' },
{ name: 'id_gas', value:'0', className: 'inputEx-Field hide' }
]
}
}
]

Thanks for your help!
Reply all
Reply to author
Forward
0 new messages