Enhancement: Interactive Forms - Conditionally show fields based on other fields value #418
hasansezertasan
started this conversation in
Ideas
Replies: 2 comments
-
Related issue that I created at the WTForms repo: pallets-eco/wtforms#825 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Can be easily done with AlpineJS or hyperscript but it's not easy to pass Overriding the Fields breaks a lot... |
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
-
Let's say that I have a Payment table with polymorphic association. This table can have either these set of values:
Identity Table has columns that are shared across with all the associated tables:
id
,date_created
,date_updated
,date_deleted
,date_received
,direction
,amount
,method
,transaction_id
Credit Card Table has columns that are related to Credit Card payments:
brand
,authorization_code
,last_four_digits
,expiration_month
,expiration_year
,markup
Check Table has columns that are related to Check payments:
type
,check_number
Other Table has columns that are related to Other types of payments:
type
method
column in the identity table is the place where we store the type of payment and it can be eitherCC
(Credit Card),CHECK
(Check), orOTHER
(other).Some statements can be like this:
check_number
input isn't required when we are adding a credit card or other payment and this shouldn't be included in the interface unless we are adding a check payment.type
input shouldn't be in the interface unless the payment method isCHECK
method
column shouldn't be in the interface in any case, it's the category of the record that the user selects when creating a new record. It can be a "tab" on the interface and treated as anenum
type.Describe the solution you'd like
I don't have one yet, but I found the question on StackOverflow:
Show fields based on the value of another field in flask admin - Stack Overflow
Additional context
Find more about polymorphic associations: Mapping Class Inheritance Hierarchies — SQLAlchemy 2.0 Documentation
Beta Was this translation helpful? Give feedback.
All reactions