Skip to content

Custom HTML Attributes in input field #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sisodiakaran opened this issue Jul 28, 2016 · 5 comments
Open

Custom HTML Attributes in input field #744

sisodiakaran opened this issue Jul 28, 2016 · 5 comments

Comments

@sisodiakaran
Copy link

Is there a way to add custom attributes to input field?

I tried like this:

{
    "key" : "number",
    "placeholder" : "xxxx-xxxx-xxxx-xxxx",
    "data-braintree-name": "number"
}

Thanks

@joelwkent
Copy link
Member

joelwkent commented Jul 28, 2016

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.

@GustavoGottardi
Copy link

Someone managed to insert html properties in inputs?

@soccermatrix
Copy link

Has anyone managed to insert html properties in inputs as of April 2017? I'm having this issue right now.

@Anthropic
Copy link
Member

@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?

@JayDoshi8533
Copy link

Can anyone has resolved this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants