I am trying to find a keyword (or modifier) to get my Asset Builder to output a Select metadata field
to print the value (instead of key) in the option tag.
i.e. <option value="ValueText">ValueText</option>
rather than <option value="KeyText">ValueText</option>
I have tried %metadata-F_1234_values% , %metadata-F_field_1234_values% , %metadata-F_1234^as_asset:{various keywords tried here}% … …
Is there a way I can get it to do what I want?
Why? We have a piece of code which is reading the “value” of the input fields, and then printing it into a preview pane as it is entered. This works for text fields. Our Key is numerical, whilst out Value is text. The Key is also used to represent in a graph, so we need a numerical value as one half of the key/value pair. If I swap the Key to be the text and the value to be numerical, then the Text printed between the Option Tags is the number - not the text (but if this can be altered, I am also OK with that, but changing the “frontend part” does not do this).
(In the mean time, I will get the Javascript code changed to have a varient for the Select options to read the options.text rather than .val – but if it is possible to print is as I originally desire, then I’d still like to know for future!)
Thanks Bart.
Good to see that piggybacking of an ^index on an ^index works.
I ended up getting out dev to change their JS code to read the .text rather than .val component.
I think the problem using asset_data was that it reads the attributes of the metadata field, rather than the value that the user has selected for the metadata field (i.e. the saved value), so it needed a single value (the selected one) rather than the whole array. The JS was also calculating it pre-submission, on an onChange action from member.
I do love the asset_data keyword though - its quite useful for looking at all the parts I can print out in Asset Listings / etc.