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
As you can see, there is a dropdown called "Content" which lets you choose the type of content. Depending on the content type, the form changes.
In this image, I chose "Attachment", which requires some fields that other types don't have.
In this image, I chose the "Text" type, and the form automatically transforms.
As you can see, if I chose the "Image" type, the form adopts its fields.
The best workaround I can think of to implement something similar to this is to create three different forms and put them in separate tabs but if someone fills the form and decides to change the type of the form, the filled part will not be in other type. Is there any implementation or a way to make this kind of form in WTForms?
The text was updated successfully, but these errors were encountered:
hasansezertasan
changed the title
Question: Is it possible to create a dynamic forms with WTForms?
Question: Is it possible to create a dynamic/adaptive forms with WTForms?
Jan 6, 2024
Yes, it is possible to process dynamic forms using field lists and nested form fields. You still need JavaScript to handle building the dynamic changes to the forms.
I'm sorry if the title wasn't clear enough but I have an example that demonstrates what I need.
I have an example that I built using json-editor/json-editor and JSON Schema.
Here is the direct link to that example: click
Here are the screenshots:
As you can see, there is a dropdown called "Content" which lets you choose the type of content. Depending on the content type, the form changes.
In this image, I chose "Attachment", which requires some fields that other types don't have.
In this image, I chose the "Text" type, and the form automatically transforms.
As you can see, if I chose the "Image" type, the form adopts its fields.
The best workaround I can think of to implement something similar to this is to create three different forms and put them in separate tabs but if someone fills the form and decides to change the type of the form, the filled part will not be in other type. Is there any implementation or a way to make this kind of form in WTForms?
The text was updated successfully, but these errors were encountered: