This Week in Wagtail

14 July 2023

This week we have some great tips for building great forms in Wagtail.

Forms, forms, forms

forms-newsletter

Forms are a pretty universal human experience. Unless you're in diapers or primary school or living on an island disconnected from the rest of human society, there's a very good chance you've filled out more than a couple of forms in your life.

Wagtail offers some great options for creating and managing forms, but there are some times when using Django forms is a better choice. When you go about building forms in Wagtail, here are a few questions you should consider before you make any designs or write any code:

  1. Who do you want to be able to edit the forms?
    If you want content creators to be able to change forms without seeking out help from a developer, you should consider using the Wagtail form builder. When you set up the form builder using the wagtailforms module, you create a page type specifically for forms that content creators can use over and over again to make new forms. This option is great for creating single-page forms, like contact forms or surveys, that can collect form responses within the Wagtail admin.

    Learn how to set up the form builder

  2. Where does the data in your form need to go?
    The form builder is great for gathering information. But if you're creating a form that will update information directly in your website database (like a user profile form) or drive other functionality on your website, you'll want to consider using Django forms instead. You'll definitely need access to the code to make changes to these forms, so consider using them only for forms that don't need frequent updates or changes.

    See an example of adding a Django form to a Wagtail project

  3. What type of data does your form need to collect?
    The form builder doesn't need much tweaking to collect text data and display it in the Wagtail admin. If you want to create a form that includes an option for uploading documents or images, then you'll have to do some extra work by customizing the form builder. The method Wagtail core team member LB shared in 2020 is for an older version of Wagtail but still provides a good example of how to add an image upload option to the form builder.

    Check out LB's tutorial on Dev.to

  4. Would a forms integration work better for you?
    There are many third-party services available for managing forms, including options like Jotforms, Typeform, and FormAssembly. If you have limited technical resources for your project or you are working with particularly sensitive data that requires higher levels of security (like private health information), then paying for a forms service could offer you some additional options for adding more advanced functions and security to your forms.

Updates made to the Wagtail Tutorial

Through his work for Google Season of Docs, Damilola Oladele has updated the Your first Wagtail site tutorial to include some new material and additional notes. We're definitely interested in what people think, so please give it a go!

Try the newest version of the tutorial

Feedback requested for Wagtail Stimulus updates

Core team member LB is seeking feedback on his latest PR to help provide better documentation and guidance for developers who want to customize the Wagtail admin with Stimulus. If you have any suggestions, please head over to GitHub and leave some comments for LB.

Visit GitHub to leave a comment on LB's PR

Package updates

Until next time, thank you for reading! If you have a news item to contribute or a package release to report, please reach out to us through the Slack community or email us.

Need help with Wagtail? Find it here.

Twitter Github Youtube