spyce
home
license
community
download
examples
resources
wishlist
contrib (@sf)
documentation
intro
lang
runtime
modules
tags
install
exits
sourceforge
statistics
freshmeat

transparent transparent transparent
Examples
[[ Spyce ]]
Python Server Pages
by Rimon Barr

examples/form.spy
<html><body>
Form handling. <br><hr>
<b>Form:</b><br>
<form method=post action="[[=request.uri('path')]]">
<table>
  <tr>
    <td valign=top>Text field:</td>
    <td><input name="textField" type=text value="" size=15></td>
  </tr><tr>
    <td valign=top>Textarea field:</td>
    <td><textarea name="textareaField" rows="5" cols="30"></textarea></td>
  </tr><tr>
    <td valign=top>Select field:</td>
    <td><select name="selectField">
      <option>Option 1</option>
      <option>Option 2</option>
      <option>Option 3</option>
    </select></td>
  </tr><tr>
    <td valign=top>Radio field:</td>
    <td>
      <input type="radio" name="radioField" value="Option 1">Option 1<br>
      <input type="radio" name="radioField" value="Option 2">Option 2<br>
      <input type="radio" name="radioField" value="Option 3">Option 3<br>
    </td>
  </tr><tr>
    <td valign=top>Checkbox field:</td>
    <td>
      <input type="checkbox" name="checkField" value="Option 1">Option 1<br>
      <input type="checkbox" name="checkField" value="Option 2">Option 2<br>
      <input type="checkbox" name="checkField" value="Option 3">Option 3<br>
    </td>
  </tr><tr>
    <td valign=top></td>
    <td><input type=submit value="Submit"></td>
  </tr>
</table>
</form><hr>

[[p=request.post1]]
<b>Results:</b><br>
<table>
  <tr><td>Text field:</td><td>[[=p('textField')]]</td></tr>
  <tr><td>Textarea field:</td><td>[[=p('textareaField')]]</td></tr>
  <tr><td>Select field:</td><td>[[=p('selectField')]]</td></tr>
  <tr><td>Radio field:</td><td>[[=p('radioField')]]</td></tr>
  <tr><td>Checkbox field:</td><td>[[=request.post('checkField')]]</td></tr>
</table>
</body></html>
Run this code.
(requires Spyce-enabled web server)

Back to List of Examples


© 2002 Rimon Barr
email: rimon AT acm DOT org
Spyce Powered SourceForge Logo [[ Spyce ]]
Python Server Pages
version 1.3.10