Form.getvalues and list

Hello,

i’m using the getvalues function to collect all inputs of a form.
In the case of the list-input the value returns the id of the selected item:

E.g.

{ type:"list" ... data:[ { id:"link1", value:"Url 1", text:"1 Tag" }, { id:"link2", value:"Url 2", text:"2 Tage" }, { id:"link3", value:"Url 3", text:"3 Tage" }, { id:"link4", value:"No url", text:"4 Tage" }, ], template:"#text#" }

If I have selected the 3rd option, getValues return for the list object “link3” as value.
Wouldn’t be better, if it returns the value? Because the id have to be a unique id. But in many cases this cannot be guaranted.

Maybe to think about …

Best regards
Horst Muerdter
CrossData-Tools

There are two kind of IDs
IDs of components - must be unique per page
IDs of forms elements, list items, etc. - must be unique per parent component.

So you can have multiple list on the page , which will use the same ID for list elements - and it will work correctly.
In above case just use

{ type:"list" ... data:[ { id:"Url 1", text:"1 Tag" }, { id:"Url 2", text:"2 Tage" }, { id:"Url 3", text:"3 Tage" }, { id:"No url", text:"4 Tage" }, ], template:"#text#" }