Search⌘ K
AI Features

Model Change with Schemaless Changesets

Explore how to build schemaless changesets to handle and validate user data in Phoenix LiveView applications that do not need to be saved to a database. Learn techniques to create changesets from basic structs, cast and validate input, and manage real-time form interactions, including practical examples like promo code forms and user input validations.

We’ve used changesets to model changes to data that is persisted in our database, but we can easily imagine scenarios in which we want to present the user with the ability to input data that isn’t persisted. Consider the following examples:

  • A guest checkout experience in which a user inputs their billing and shipping info without saving it.
  • A gaming UI in which a user provides a temporary username for the lifespan of the game.
  • A search form in which input is validated but not saved.

All of these scenarios require presenting some interface to the user for collecting input, validating ...