views:

40

answers:

2

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

Thanks

+2  A: 

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

piddl0r
+2  A: 

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