Replies: 1 comment
-
|
Yeah, I like the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problems
There are some problems with the current Form system:
Stringmight be constructed using a single-line text field, or an HTML text area)Because of the above, the form system needs to be improved.
Solutions
Problem 1
The simplest idea would be to allow specifying the widget using
#[form]attributes:This is similar to what Django implements.
Problem 2
An idea is to introduce "form types", which would be a piece of metadata encoded in the type system, specifying what kind of form are we dealing with.
Instead of having a single
#[derive(Form)]macro, we could have an attribute macro#[form]instead, allowing us to specify the type of the form, such as#[form(type = AdminForm)], for instance. Then, theFormtrait would instead becomeForm<FormType>trait instead, allowing multipleFormimplementations for the same struct. Then, each type could define the form type it has a form widget for, allowing us to definite completely different widgets for generic and admin forms, and for the users to specify their own form types as well.Beta Was this translation helpful? Give feedback.
All reactions