Forms

GET method

The simple url-coded form can be written as

<form action="form.wsp" method="get">
    <div>
        <label for="say">What greeting do you want to say?</label>
        <input name="say" id="say" value="Hi">
    </div>
    <div>
        <label for="to">Who do you want to say it to?</label>
        <input name="to" id="to" value="Mom">
    </div>
    <div>
        <button>Send my greetings</button>
    </div>
</form>

Somewhere in form.html you can fetch the result using

<?wsp session["Query", "say"] ?>

POST method

The simple form can be written similar to the previous example, however the data is sent differently and has no limitations on the size

<form action="form.wsp" method="post">
    <div>
        <label for="say">What greeting do you want to say?</label>
        <input name="say" id="say" value="Hi">
    </div>
    <div>
        <label for="to">Who do you want to say it to?</label>
        <input name="to" id="to" value="Mom">
    </div>
    <div>
        <button>Send my greetings</button>
    </div>
</form>

The result is stored in data field

<?wsp session["data", "say"] ?>

To transfer multiple field can be done in the same fashion. You should change the encoding type

<form action="form.wsp" method="post" enctype='multipart/form-data'>
    <div>
         <label for="say">What greeting do you want to say?</label>
         <input name="say" id="say" value="Hi">
    </div>
    <div>
         <label for="to">Who do you want to say it to?</label>
         <input name="to" id="to" value="Mom">
    </div>
        <input type="file" name="files" multiple>
    <div>
         <button>Send my greetings</button>
    </div>
</form>

Each file has a field with the filename and its data stored as a ByteArray

<?wsp session["data", "files"] ?>

Only text files are supported for now.

For the debugging purpose you can pass the result to some global variable you defined

<?wsp debug = session["data", "files"] ?>

or create a picture...

<?wsp ExportString[session["data", "files"], "SVG"] ?>

More about session you can find at Session.