I am in the process of writing a small javascript library to make form creation/validation easier. This is mostly an excuse to get better with javascript. I am debating about how to take in user input for form element creation.
I am looking at two approaches. One is to take in a few pre-determined parameters such as id, label, value
The other is to take in a single object which will be used to write properties straight into the form element. So for example if I wanted to pass in id label and value, I would simply pass in {id : 'my_id', label : 'my_label', value : 'my_value}
The third option is to take in id, label, options where options is an object which does what I have described above.
Right now the passing an object in seems the most flexible, but I wonder if there are any serious downsides to this? I would like this to be easy to use for most javascript users. Any thoughts on the best way to do this?