Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • BaseControl
  • Button
  • Checkbox
  • HiddenField
  • ImageButton
  • MultiSelectBox
  • RadioList
  • SelectBox
  • SubmitButton
  • TextArea
  • TextBase
  • TextInput
  • UploadControl
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  */
11: 
12: namespace Nette\Forms\Controls;
13: 
14: use Nette;
15: 
16: 
17: 
18: /**
19:  * Hidden form control used to store a non-displayed value.
20:  *
21:  * @author     David Grudl
22:  */
23: class HiddenField extends BaseControl
24: {
25:     /** @var string */
26:     private $forcedValue;
27: 
28: 
29: 
30:     public function __construct($forcedValue = NULL)
31:     {
32:         parent::__construct();
33:         $this->control->type = 'hidden';
34:         $this->value = (string) $forcedValue;
35:         $this->forcedValue = $forcedValue;
36:     }
37: 
38: 
39: 
40:     /**
41:      * Bypasses label generation.
42:      * @return void
43:      */
44:     public function getLabel($caption = NULL)
45:     {
46:         return NULL;
47:     }
48: 
49: 
50: 
51:     /**
52:      * Sets control's value.
53:      * @param  string
54:      * @return HiddenField  provides a fluent interface
55:      */
56:     public function setValue($value)
57:     {
58:         $this->value = is_scalar($value) ? (string) $value : '';
59:         return $this;
60:     }
61: 
62: 
63: 
64:     /**
65:      * Generates control's HTML element.
66:      * @return Nette\Utils\Html
67:      */
68:     public function getControl()
69:     {
70:         return parent::getControl()
71:             ->value($this->forcedValue === NULL ? $this->value : $this->forcedValue)
72:             ->data('nette-rules', NULL);
73:     }
74: 
75: }
76: 
Nette Framework 2.0.6 API API documentation generated by ApiGen 2.7.0