Request Form Example

This example shows you how to read information that was posted to a webpage. Note that request.form() and request.form.list() are actually the same method.

Smartsite SXML CopyCode image Copy Code
<se:if expression="request.ispostback()">
    <se:then>
        Your first name is {request.form(FirstName)}.
        Is the last name posted: {request.form.exists(LastName)}
        
        Dump all posted fields:
        {debug.write(request.form())}
    </se:then>
    <se:else>
        <form method="post">
            <p>
                First name: <input type="text" name="FirstName" />
                Last name: <input type="text" name="LastName" />
                <input type="submit" />
            </p>
        </form>
    </se:else>
</se:if>
Example Result CopyCode image Copy Code
<form method="post">
            <p>
                First name: <input type="text" name="FirstName" />
                Last name: <input type="text" name="LastName" />
                <input type="submit" />
            </p>
        </form>