Example: Custom form rendering
- 1: <?php
- 3: /**
- 4: * Nette\Forms example 4
- 5: *
- 6: * - custom form rendering
- 7: */
- 50: // Step 1: Define form with validation rules
- 52: // setup custom rendering
- 67: // group Personal data
- 85: // group Shipping address
- 94: // subgroup
- 110: // group Your account
- 130: // group for buttons
- 137: // Step 2: Check if form was submitted?
- 140: // Step 2c: Check if form is valid
- 147: // this is the end, my friend :-)
- 149: }
- 152: // not submitted, define default values
- 160: }
- 164: // Step 3: Render form
- 165: ?>
- 166: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- 167: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- 168: <head>
- 169: <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- 170: <meta http-equiv="content-language" content="en" />
- 172: <title>Nette\Forms example 4 | Nette Framework</title>
- 174: <style type="text/css">
- 175: <!--
- 176: body {
- 177: font-family: "Trebuchet MS", "Geneva CE", lucida, sans-serif;
- 178: }
- 180: .required {
- 181: font-weight: bold;
- 182: }
- 184: .error {
- 185: color: red;
- 186: }
- 188: input.text {
- 189: border: 1px solid #78bd3f;
- 190: padding: 3px;
- 191: color: black;
- 192: background: white;
- 193: }
- 195: input.button {
- 196: font-size: 120%;
- 197: }
- 199: dt, dd {
- 200: padding: .5em 1em;
- 201: }
- 203: #form {
- 204: width: 550px;
- 205: }
- 207: #form h3 {
- 208: background: #78bd3f;
- 209: color: white;
- 210: margin: 0;
- 211: padding: .1em 1em;
- 212: font-size: 100%;
- 213: font-weight: normal;
- 214: clear: both;
- 215: }
- 217: #form dl {
- 218: background: #F8F8F8;
- 219: margin: 0;
- 220: }
- 222: #form dt {
- 223: text-align: right;
- 224: font-weight: normal;
- 225: float: left;
- 226: width: 10em;
- 227: clear: both;
- 228: }
- 230: #form dd {
- 231: margin: 0;
- 232: padding-left: 10em;
- 233: display: block;
- 234: }
- 236: #form dd ul {
- 237: list-style: none;
- 238: font-size: 90%;
- 239: }
- 241: #form dd.odd {
- 242: background: #EEE;
- 243: }
- 244: -->
- 245: </style>
- 246: </head>
- 248: <body>
- 249: <h1>Nette\Forms example 4</h1>
- 252: </body>
- 253: </html>