# Form Demo A simple example of a 2 column grid based on the [fasthtml demo](https://github.com/AnswerDotAI/fasthtml-example/blob/main/htmx/formdemo.py).

Source Code

from fasthtml.common import *

app, rt = fast_app()

@app.get('/')
def homepage():
    return Titled('Try editing fields:', Grid(
        Form(hx_post="/submit", hx_target="#result", hx_trigger="input delay:200ms")(
            Select(Option("One"), Option("Two"), id="select"),
            Input(value='j', id="name", placeholder="Name"),
            Input(value='h', id="email", placeholder="Email")),
        Div(id="result")
    ))


@app.post('/submit')
def post(d:dict):
    return Div(*[Div(P(Strong(k),':  ',v)) for k,v in d.items()])

Live Demo

Try editing fields:

Try editing fields: