To test the usage of radio buttons, we need to add some to a form in our app. We will introduce a radio button in the to-do item creation form to indicate if an alarm should be scheduled. Depending on the selected value, a field should appear, allowing us to set the to-do item's alarm date and time.
First, we need to change the to-do item creation template in
templates/todos/new.html
to:<h1>New To-Do</h1> <form id="new-todo-form" action="/todos" method="POST"> <p> <label for="what">What</label> <textarea name="what" id="what" required></textarea> </p> <p> <label class="radio" for="alarm-false"> <input type="radio" name="alarm" value="false" id="alarm-false" checked="checked" /> No Alarm </label> <label class="radio" for="alarm-true"> <input type="radio" name="alarm" value="true" id="alarm-true" /> Use Alarm </label> <...