That example is using an atom as form - which is supported, but isn’t going to do much with the dynamic input generation since that implementation of FormData just returns :text_input:
OTOH using value: with a form backed by a Changeset is not usually what you want.
In any case, you’ll want to look into extracting opts[:value] (if it’s passed to input) and then including it in input_opts.
Actually, what you describe here is what I am doing:
input_opts = [
class: "border rounded #{state_class(form, field)} #{opts[:class_input]}"
]
if opts[:value] do
input_opts = Keyword.merge(input_opts, value: opts[:value])
end
but the field remains empty (as the record does not exist yet). I suppose it gets overridden by the actual input = apply(Phoenix.HTML.Form, type, [form, field, input_opts]) call, but I am not sure.
To your question about why: I do have another table with customer input and similar fields. I want to give some kind of “suggestion” here from the user input, or more specific the input for the new record shall somehow be pre-populated with the data as a suggestion.