![]() We'll model game invitations in their module. We'll begin where you'll almost always want to start when building a new feature in a Phoenix application - in the application core. Instead, we'll keep our focus on the form validations in LiveView. We won't worry too much about the exact details of sending emails for now. It should show any validation errors, as well as the results of a successful form submission in real-time. Our form will need to implement some validation - namely, to ensure that a valid email address is provided. This will email a link to the recipient's email address so they can join the game. A user can invite a friend to play a game with them by filling out a form with the friend's email address. We'll focus on that last piece of functionality. A user can log in, select a game to play, and even invite friends to play games with them. Imagine that you're responsible for a Phoenix web app, Arcade, that provides in-browser games to users. Check it out for an even deeper dive into LiveView testing and so much more.īefore we dive into writing any actual code, let's talk about the feature we'll build. The form examples we'll be looking at in this post are inspired by the "Forms and Changesets" chapter in my book, Programming LiveView, co-authored with Bruce Tate. The Feature: Adding a Form to a Phoenix LiveView App Along the way, you'll learn how to model change in your Phoenix application with schemaless changesets and compose LiveView code to handle that change. In this post, I'll show you how to build LiveView forms that validate changes and provide feedback to the user in real-time. These days, users expect to see form feedback presented to them in real-time, and LiveView offers first-class support for exactly that. Some of the most common interactions on the web are form validation and submission. This can empower you to deliver interactive features in single-page apps faster than ever before. LiveView keeps the developer's mind firmly rooted on the server-side, even when testing and debugging. Built on top of Elixir's OTP tooling and leveraging WebSockets, it offers super-fast real-time, interactive features alongside impressive developer productivity. LiveView is a compelling choice for building modern web apps.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |