Source for file Form.php
Documentation is available at Form.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see http://nettephp.com
- 12: *
- 18: */
- 26: /**
- 27: * Creates, validates and renders HTML forms.
- 28: *
- 32: *
- 34: * @example forms/manual-rendering.php Manual form rendering and separated form and rules definition
- 39: * @example forms/CSRF-protection.php How to use Cross-Site Request Forgery (CSRF) form protection
- 41: *
- 52: */
- 54: {
- 55: /**#@+ operation name */
- 61: // button
- 64: // text
- 76: // file upload
- 80: // special case
- 82: /**#@-*/
- 84: /**#@+ method */
- 87: /**#@-*/
- 95: /** @var array of function(Form $sender); Occurs when the form is submitted and successfully validated */
- 98: /** @var array of function(Form $sender); Occurs when the form is submitted and not validated */
- 127: /**
- 128: * Form constructor.
- 130: */
- 132: {
- 141: }
- 143: }
- 147: /**
- 148: * This method will be called when the component (or component's parent)
- 149: * becomes attached to a monitored object. Do not call this method yourself.
- 152: */
- 154: {
- 157: }
- 158: }
- 162: /**
- 163: * Returns self.
- 165: */
- 167: {
- 169: }
- 173: /**
- 174: * Sets form's action.
- 177: */
- 179: {
- 182: }
- 186: /**
- 187: * Returns form's action.
- 189: */
- 191: {
- 193: }
- 197: /**
- 198: * Sets form's method.
- 201: */
- 203: {
- 206: }
- 209: }
- 213: /**
- 214: * Returns form's method.
- 216: */
- 218: {
- 220: }
- 224: /**
- 226: */
- 228: {
- 229: throw new DeprecatedException(__METHOD__ . '() is deprecated; pass form name to the constructor.');
- 230: }
- 234: /**
- 235: * Cross-Site Request Forgery (CSRF) form protection.
- 239: */
- 241: {
- 248: }
- 251: $this[self::PROTECTOR_ID]->addRule(':equal', empty($message) ? 'Security token did not match. Possible CSRF attack.' : $message, $token);
- 252: }
- 256: /**
- 257: * Adds fieldset group to the form.
- 261: */
- 263: {
- 270: }
- 276: }
- 277: }
- 281: /**
- 282: * Removes fieldset group from form.
- 285: */
- 287: {
- 297: }
- 301: }
- 304: }
- 308: /**
- 309: * Returns all defined groups.
- 311: */
- 313: {
- 315: }
- 319: /**
- 320: * Returns the specified group.
- 323: */
- 325: {
- 327: }
- 331: /**
- 332: * Set the encoding for the values.
- 335: */
- 337: {
- 340: throw new Exception("The PHP extension 'mbstring' is required for this encoding but is not loaded.");
- 341: }
- 343: }
- 347: /**
- 348: * Returns the encoding.
- 350: */
- 352: {
- 354: }
- 358: /********************* translator ****************d*g**/
- 362: /**
- 363: * Sets translate adapter.
- 366: */
- 368: {
- 371: }
- 375: /**
- 376: * Returns translate adapter.
- 378: */
- 380: {
- 382: }
- 386: /********************* submission ****************d*g**/
- 390: /**
- 391: * Tells if the form is anchored.
- 393: */
- 395: {
- 397: }
- 401: /**
- 402: * Tells if the form was submitted.
- 404: */
- 406: {
- 410: }
- 412: }
- 416: /**
- 417: * Sets the submittor control.
- 420: */
- 422: {
- 425: }
- 429: /**
- 430: * Returns submitted HTTP data.
- 432: */
- 434: {
- 437: throw new InvalidStateException('Form is not anchored and therefore can not determine whether it was submitted.');
- 438: }
- 440: }
- 442: }
- 446: /**
- 447: * Fires submit/click events.
- 449: */
- 451: {
- 462: }
- 469: }
- 470: }
- 474: /**
- 475: * Internal: receives submitted HTTP data.
- 477: */
- 479: {
- 483: }
- 490: }
- 495: }
- 496: }
- 499: }
- 503: /**
- 505: */
- 507: {
- 509: }
- 513: /********************* data exchange ****************d*g**/
- 517: /**
- 518: * Returns the values submitted by the form.
- 520: */
- 522: {
- 526: }
- 530: /********************* validation ****************d*g**/
- 534: /**
- 535: * Adds error message to the list.
- 538: */
- 540: {
- 544: }
- 545: }
- 549: /**
- 550: * Returns validation errors.
- 552: */
- 554: {
- 556: }
- 560: /**
- 562: */
- 564: {
- 566: }
- 570: /**
- 572: */
- 574: {
- 577: }
- 581: /********************* rendering ****************d*g**/
- 585: /**
- 586: * Returns form's HTML element template.
- 588: */
- 590: {
- 592: }
- 596: /**
- 597: * Sets form renderer.
- 600: */
- 602: {
- 605: }
- 609: /**
- 610: * Returns form renderer.
- 612: */
- 614: {
- 617: }
- 619: }
- 623: /**
- 624: * Renders form.
- 626: */
- 628: {
- 637: }
- 638: }
- 642: /**
- 643: * Renders form to string.
- 646: */
- 648: {
- 654: }
- 662: }
- 663: }
- 664: }
- 668: /********************* backend ****************d*g**/
- 672: /**
- 674: */
- 676: {
- 678: }
- 682: /**
- 684: */
- 686: {
- 688: }
- 690: }