You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
does not result in <input required="true"> in the HTML. While this can be achieved by setting the widget manually after the fact, it seems counter intuitive to me that passing options to the widget requires an extra step.
Changing 17, 98, 119 of lib/fields.js from forms.widgets.___() to forms.widgets.___(opt) provides what is, in my opinion, more intuitive default behavior.
This also requires String(opt[k]).replace(...) in widgets.js:31, to convert "true" and similar into strings.
The text was updated successfully, but these errors were encountered:
It sounds like you're just suggesting passing the options hash through to the widget call from the field call?
it'd be required="required" or required - "true" isn't a valid value for a boolean attribute. So yes, it would require a sanitization method to convert the field options into widget options, and that would include translating boolean trues into the attribute name (ie required: true becomes required: "required") and unsetting boolean falses, for all boolean attributes - disabled, selected, checked, required, readonly, and a number of others.
Actually, even better - "opt" should support an "attrs" hash that is explicitly for HTML attributes.
Making HTML5 form validation attributes automatically appear might actually not be the desired behavior, since one can't style form validation errors, and their behavior in browsers varies widely.
does not result in
<input required="true">
in the HTML. While this can be achieved by setting the widget manually after the fact, it seems counter intuitive to me that passing options to the widget requires an extra step.Changing 17, 98, 119 of lib/fields.js from
forms.widgets.___()
toforms.widgets.___(opt)
provides what is, in my opinion, more intuitive default behavior.This also requires
String(opt[k]).replace(...)
in widgets.js:31, to convert "true" and similar into strings.The text was updated successfully, but these errors were encountered: