Is supporting FormField
instead of passing form
and field
something that is planned / would PRs be accepted, or is there a reason for it not be accepted?
It’s of course not a big deal and it is easy to write some small utility functions, but I think it would be nice was it builtin:
def input_id(%FormField{} = field) do
input_id(field.form, field.field)
end
def to_forms(%FormField{} = field, options \\ []) do
FormData.to_form(field.form.source, field.form, field.field, options)
end
def input_value(%FormField{} = field) do
input_value(field.form, field.field)
end
Don’t we already have the id and value in the FormField?
2 Likes
Oops, indeed, some of my examples are silly
I believe the question remains valid for functions like to_form/4
/ inputs_for/4
, text_input/3
, label
, etc.
Maybe template functions are in the works and they will support FormField, like inputs_for/1
does?
There are not. You can generate a new phoenix project to see it generate a few helper components for you, but there are no more library provided components for inputs.
For what is worth, text_input and friends will be moved to a separate library in Phoenix HTML v4.0. They will still be maintained, since many people have used them for so long, but no longer included in new Phoenix projects. Check the repo to learn more! So we probably won’t be adding more functionality to them.
2 Likes