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

Classes

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