0

I want to create a textfield element in Zend Form which always type in uppercase whether CapsLock is On or Off.

Thanks

Gordon
  • 312,688
  • 75
  • 539
  • 559
Awan
  • 18,096
  • 36
  • 89
  • 131
  • This is a possible duplicate of: http://stackoverflow.com/questions/202368/how-can-i-force-input-to-uppercase-in-an-asp-net-textbox – tplaner Oct 25 '10 at 14:13

2 Answers2

2

That will have to be client side scripted, if you use Zend_Dojo_Form you can use setUppercase($flag) or pop you favorite bit of Javascript in. You can use Zend_Validate to check server side once it has been submitted.

ZF validation docs

Community
  • 1
  • 1
piddl0r
  • 2,431
  • 2
  • 23
  • 35
2

Zend_Form is a serverside representation of a Standard HTML form. Standard HTML Form have no built-in facility to force uppercase in the client. This would have to be enforced through the use of JavaScript. You have several options:

  1. add some JavaScript code on the page that has the form and force uppercase from the clientside
  2. add a Zend_Filter_StringToUpper filter to the element to make all input uppercase when data is passed to the form on the serverside
  3. use a Zend_Dojo_Form_Element_TextBox with setUppercase set to true
Gordon
  • 312,688
  • 75
  • 539
  • 559