View Source

[examples]
context.wtcl
cookies.wtcl
cookiesIntro.wtcl
errors.wtcl
errorsIntro.wtcl
expr.wtcl
fish.jpg
fish.wtcl
flush.wtcl
flushIntro.wtcl
form.wtcl
formIntro.wtcl
index.wtcl
ready.wtcl
scripting.wtcl
scripting.wtcl~
scriptingIntro.wtcl
session.wtcl
sessionIntro.wtcl
uploads/
uploads.wtcl
uploadsIntro.wtcl
virtual.wtcl
virtualIntro.wtcl
File: / examples / form.wtcl

Lines Size Modified Created Owner MIME Types
153 4,015 2010/05/18 23:04:06 2011/06/13 15:35:16 BUILTIN\Administrators application/x-wtcl, text/x-wtcl

0001
<?
0002
0003
include ../lib/examplePage.wtcl
0004
0005
::wt::examples::setTitle "Form"
0006
0007
include ../lib/header.wtcl
0008
0009
# Continent select
0010
0011
set continents [list \
0012
  AF Africa \
0013
  AS Asia \
0014
  EU Europe \
0015
  NA "North America" \
0016
  OC Oceania \
0017
  SA "South America"]
0018
0019
set selectedValues [list [params get continent NA]]
0020
set styleProps [list width "300px"]
0021
0022
set sel [table create \
0023
  name           continent \
0024
  options        $continents \
0025
  selectedValues $selectedValues \
0026
  styleProps     $styleProps]
0027
0028
set continentSelect [::wt::web::printSelect $sel]
0029
0030
# Protocol select
0031
0032
set protocols [table create \
0033
  BOOTP  "Bootstrap Protocol" \
0034
  DNS    "Domain Name Service" \
0035
  DHCP   "Dynamic Host Configuration Protocol" \
0036
  FTP    "File Transfer Protocol" \
0037
  HTTP   "HyperText Transfer Protocol" \
0038
  IMAP   "Internet Message Access Protocol" \
0039
  LDAP   "Lightweight Directory Access Protocol" \
0040
  MIME   "Multipurpose Internet Mail Extensions" \
0041
  NNTP   "News Network Transfer Protocol" \
0042
  NTP    "Network Time Protocol" \
0043
  POP3   "Post Office Protocol Version 3" \
0044
  SSH    "Secure Shell" \
0045
  SIP    "Session Initiation Protocol" \
0046
  SMTP   "Simple Mail Transfer Protocol" \
0047
  SNMP   "Simple Network Management Protocol" \
0048
  SOAP   "Simple Object Access Protocol" \
0049
  TFTP   "Trivial File Transfer Protocol"]
0050
0051
set options {}
0052
set keys [lsort [table keys $protocols]]
0053
foreach key $keys {
0054
  lappend options $key "$key ([table get $protocols $key])"
0055
}
0056
0057
set selectedValues [params getAll protocol SSH]
0058
set styleProps [list width "300px"]
0059
0060
set sel [table create \
0061
  name           protocol \
0062
  isMulti        1 \
0063
  attributes     [list size 10] \
0064
  options        $options \
0065
  selectedValues $selectedValues \
0066
  styleProps     $styleProps]
0067
0068
set protocolSelect [::wt::web::printSelect $sel]
0069
0070
# Time of day
0071
0072
set tod [params get tod ""]
0073
set morn [::wt::web::printRadio tod morning \
0074
  [expr {$tod == "morning"}]]
0075
set aft [::wt::web::printRadio tod afternoon \
0076
  [expr {$tod == "afternoon"}]]
0077
set eve [::wt::web::printRadio tod evening \
0078
  [expr {$tod == "evening"}]]
0079
0080
?>
0081
0082
<? if {[params get action ""] == "submit"} { ?>
0083
0084
<h3>Form Values</h3>
0085
0086
<table cellpadding=5 cellspacing=1 border=0 bgcolor=black width=300>
0087
<tr>
0088
  <td bgcolor=white width=100 style="padding: 5px;"><b>Name</b></td>
0089
  <td bgcolor=white style="padding: 5px 5px 5px 10px;">[htmlEncode [params get name ""]]</td>
0090
</tr>
0091
<tr valign=top>
0092
  <td bgcolor=white width=100 style="padding: 5px;"><b>Continent</b></td>
0093
  <td bgcolor=white style="padding: 5px 5px 5px 10px;">[htmlEncode [params get continent ""]]</td>
0094
</tr>
0095
<tr valign=top>
0096
  <td bgcolor=white width=100 style="padding: 5px;"><b>Protocols</b></td>
0097
  <td bgcolor=white style="padding: 5px 5px 5px 10px;">
0098
    <? foreach x [params getAll protocol {}] { ?>
0099
      [htmlEncode $x]<br>
0100
    <? } ?>
0101
  </td>
0102
</tr>
0103
<tr valign=top>
0104
  <td bgcolor=white width=100 style="padding: 5px;"><b>Time of Day</b></td>
0105
  <td bgcolor=white style="padding: 5px 5px 5px 10px;">[htmlEncode [params get tod ""]]</td>
0106
</tr>
0107
<tr valign=top>
0108
  <td bgcolor=white width=100 style="padding: 5px;"><b>Comments</b></td>
0109
  <td bgcolor=white style="padding: 5px 5px 5px 10px;">[htmlEncode [params get comments ""]]</td>
0110
</tr>
0111
</table>
0112
0113
<? } ?>
0114
0115
<h3>Enter Information</h3>
0116
0117
<form action="[selfUrl -html]">
0118
0119
<div style="width: 300px;">
0120
Name<br>
0121
<input name=name style="width: 300px;" value="[htmlEncode [params get name ""]]"><br>
0122
<br style="line-height: 12px;">
0123
0124
Continent<br>
0125
$continentSelect<br>
0126
<br style="line-height: 12px;">
0127
0128
Protocols<br>
0129
$protocolSelect<br>
0130
<br style="line-height: 12px;">
0131
0132
Time of Day<br>
0133
<ul style="margin-bottom: 0px;">
0134
  $morn Morning<br>
0135
  $aft Afternoon<br>
0136
  $eve Evening<br>
0137
</ul>
0138
<br style="line-height: 12px;">
0139
0140
Comments<br>
0141
<textarea name=comments style="width: 300px;">[::wt::web::htmlEncode [params get comments ""]]</textarea><br>
0142
<br style="line-height: 12px;">
0143
0144
<hr>
0145
<div align=right>
0146
<input type=submit value=" OK ">
0147
</div>
0148
</div>
0149
0150
<input type=hidden name=action value=submit>
0151
</form>
0152
0153
<? include ../lib/footer.wtcl ?>