-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleForm.kid
25 lines (25 loc) · 968 Bytes
/
SimpleForm.kid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?xml version='1.0' encoding='utf-8'?>
<?python
from KidKit.Examples.KidExamplePage import KidExamplePage
hook = KidExamplePage.writeContent
?>
<div style="text-align:center"
xmlns:py="http://purl.org/kid/ns#">
<?python
# Note that the above div element is the root element of this page,
# because it is embedded in the body of the KidExamplePage template.
# For a stand-alone page, the html element will be the root element.
# Also, note that this Python block is just inside the root element.
# That makes it "local-level", where the 'servlet' variable is available.
# Outside the root element, the servlet is not yet instantiated.
fields = servlet.request().fields()
name = fields.get('name') or 'stranger'
?>
<h1>Kid Form Demo</h1>
<p>Hello <strong py:content="name"/>, how are you?</p>
<form action="" method="get">
<p>Enter your name here:</p>
<p><input type="text" name="name"/></p>
<p><input type="submit" name="Submit" value="Submit"/></p>
</form>
</div>