text.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3. /**
  4. * HTML class for a text field
  5. *
  6. * PHP versions 4 and 5
  7. *
  8. * LICENSE: This source file is subject to version 3.01 of the PHP license
  9. * that is available through the world-wide-web at the following URI:
  10. * http://www.php.net/license/3_01.txt If you did not receive a copy of
  11. * the PHP License and are unable to obtain it through the web, please
  12. * send a note to license@php.net so we can mail you a copy immediately.
  13. *
  14. * @category HTML
  15. * @package HTML_QuickForm
  16. * @author Adam Daniel <adaniel1@eesus.jnj.com>
  17. * @author Bertrand Mansion <bmansion@mamasam.com>
  18. * @copyright 2001-2009 The PHP Group
  19. * @license http://www.php.net/license/3_01.txt PHP License 3.01
  20. * @version CVS: $Id: text.php,v 1.7 2009/04/04 21:34:04 avb Exp $
  21. * @link http://pear.php.net/package/HTML_QuickForm
  22. */
  23. /**
  24. * Base class for <input /> form elements
  25. */
  26. require_once 'HTML/QuickForm/input.php';
  27. /**
  28. * HTML class for a text field
  29. *
  30. * @category HTML
  31. * @package HTML_QuickForm
  32. * @author Adam Daniel <adaniel1@eesus.jnj.com>
  33. * @author Bertrand Mansion <bmansion@mamasam.com>
  34. * @version Release: 3.2.11
  35. * @since 1.0
  36. */
  37. class HTML_QuickForm_text extends HTML_QuickForm_input
  38. {
  39. /**
  40. * Class constructor
  41. *
  42. * @param string $elementName (optional)Input field name attribute
  43. * @param string $elementLabel (optional)Input field label
  44. * @param mixed $attributes (optional)Either a typical HTML attribute string
  45. * or an associative array
  46. * @since 1.0
  47. * @access public
  48. * @return void
  49. */
  50. function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null)
  51. {
  52. HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
  53. $this->_persistantFreeze = true;
  54. $this->setType('text');
  55. }
  56. /**
  57. * Sets size of text field
  58. *
  59. * @param string $size Size of text field
  60. * @since 1.3
  61. * @access public
  62. * @return void
  63. */
  64. function setSize($size)
  65. {
  66. $this->updateAttributes(array('size'=>$size));
  67. }
  68. /**
  69. * Sets maxlength of text field
  70. *
  71. * @param string $maxlength Maximum length of text field
  72. * @since 1.3
  73. * @access public
  74. * @return void
  75. */
  76. function setMaxlength($maxlength)
  77. {
  78. $this->updateAttributes(array('maxlength'=>$maxlength));
  79. } //end func setMaxlength
  80. }