minikomi/Bootstrap-Form-Builder

Adding "autocomplete" attribute as an option when adding a form field.

madmath opened this issue · 1 comments

Hello,

It would be great if you would add the option to specify one of the HTML5 "autocomplete" attribute values when adding a form element. In It could be an additional dropdown in the same location where users enter the label and description.

This way the produced forms would have autofill support out of the box. Here is the spec for the possible values:

https://html.spec.whatwg.org/multipage/forms.html#autofill

Let me know what you think!

This one is a simple addition.
Assuming you are using main-built.js
In your JSON array for the form inputs you need to add the field.. for example.
"placeholder":{
"label":"Placeholder",
"type":"input",
"value":"placeholder"
},
"autocomplete":{
"label":"autocomplete",
"type":"input",
"value":"autocomplete"
},
"helptext":{
"label":"Help Text",
"type":"input",
"value":""
},

The in the associate input definition (i.e textbox)

name="<%= id %>" type="text" placeholder="<%= placeholder %>" autocomplete="<%= autocomplete %>"

That should do it

if you add autocomplete="<%= autocomplete %>" to an input definition and it has not also been described for that input in the JSON array, the script will fail