Closed edjiang closed 8 years ago
type - the value to apply to the type attribute of HTML input element (e.g. text, password).
As you've found, text and password are the only practical types for this field.
The spec leaves it ambiguous as to whether or not text/password are examples, (hence the eg) or the only supported options.
checkbox
is a valid HTML input type, and actually works in express-stormpath.
Thanks, can you make a PR that clarifies?
Sure. I'll do so tomorrow.
I think we should also totally support number types. This has come up many times w/ customers. Thoughts?
My opinion is that the developer should be able to define whatever they what, but checkbox and radio are going to act weird without a proper form parsing library. As such, I think our spec should leave this undefined and simply state that we pass this value directly to the HTML form element. Simple.
And mobile falls back to a text input type? Or has undefined behavior?
You'll have to decide how HTML5 input types can map onto iOS input tyhpes.
The type
field in config is supposed to be whatever the user wants. In a server-side rendering framework, these string values should be identical to an HTML5 input type. They could change it to be radio
if they want, but then they'll need to change the html template to deal with that accordingly. Nothing wrong with that either - its up to them if they want to render the model however they wish if it is not compatible with our default view templates.
I've updated master to be more clear about this situation:
type
- the value to apply to the type attribute of HTML input element.The intention of this configuration is to give the developer some simple control over the basic things: labels, placeholders, and text input types. Mileage will vary with other HTML input types, as some of those types require additional attributes that we do not define in our configuration at this time.
For instance, I tried using "checkbox" and while it technically worked, did not seem supported in
express-stormpath
, and didn't work at all in laravel.Radio doesn't make sense with our configuration options, button doesn't make sense, and there's a bunch of HTML5 input types that I don't think we validate.