Search code examples
htmlgridviewuppercaseext.net

Uppercase for textfield


HTML

style='text-transform:uppercase'

tried this but it change the label of the text box. I want to make the letter upper case in the input box not the label. And after save it it will appear in grid view.Thank you


Solution

  • To apply a style just to the field use:

    FieldStyle="text-transform:uppercase"
    

    However, that is going to make the whole field uppercase. I prefer a renderer like in the grids, but you could use a listener to overwrite the field value. Either way the processing is on the client side, no round trips.

    <ext:TextField ID="TextFieldUC" runat="server" FieldLabel="Name with UC First" EnableKeyEvents="true">
         <Listeners>
             <KeyPress Handler="#{TextFieldUC}.setValue( #{TextFieldUC}.getValue().charAt(0).toUpperCase() + #{TextFieldUC}.getValue().slice(1)  )" Delay="33" />
         </Listeners>
    </ext:TextField>