Open sisodiakaran opened 8 years ago
Hi @sisodiakaran I don't think this is currently supported but this is something I've also wanted in the past. The ability to add data attributes to input fields. So like you say above, properties prefixed with 'data-' or maybe a 'data' object property like below (i've made up another data attribute called braintree-order)
{
"key" : "number",
"placeholder" : "xxxx-xxxx-xxxx-xxxx",
"data": {
"braintree-name": "number",
"braintree-order": "3",
}
}
Which would then appear in the rendered form html as:
<input
type="text"
name="number"
placeholder="xxxx-xxxx-xxxx-xxxx"
data-braintree-name="number"
data-braintree-order="3">
...
/>
I don't think this is currently supported but it could be useful.
Someone managed to insert html properties in inputs?
Has anyone managed to insert html properties in inputs as of April 2017? I'm having this issue right now.
@joelwkent did you ever get anywhere on this? I assume it would only take a template modification and a function on scope to serialize into a string like (using your example)
<input data-braintree-name="number" data-braintree-order="3"/>
An add on can modify the form object, so conceivably you could put the function in the form object and then modify the templates to call it once without too much trouble. Thoughts?
Can anyone has resolved this issue?
Is there a way to add custom attributes to input field?
I tried like this:
Thanks