Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an input box which asks users to input a UK postcode but which specifies that this must be in lower case, for example so16 0as. Some users find this frustrating as they would just like to copy and paste a post code into the textfield; the copied postcode may contain upper case letters ie SO16 0AS. This will return an error.

The input code is as follows:

items: [{
            xtype: "textfield",
            width: 220,
            name: "search_lc",
            value: "",
            emptyText:'Enter Postcode (e.g. so16 0as)',
            fieldLabel: "Find",
            allowblank: false

I have tried to use fieldStyle: 'text-transform:lowercase' both below the fieldLabel and above it but this doesn't work.

I'mm thinking that this should be a fairly simple thing to resolve but I am experiencing a 'can't see the wood for the trees moment'! Any help gratefully received!

Many thanks,


share|improve this question

Use a custom validation function, see the API of Ext (GeoExt base for non-Geo stuff) for that:!/api/Ext.form.field.Text-cfg-validator .

Even better: use a Regular Expression, as

items: [{
    xtype: 'textfield',
    name: 'name',
    fieldLabel: 'Name',
    allowBlank: false,  // requires a non-empty value
    regex: /^[A-Za-z0-9]+$/

I am unfamiliar with the exact Regex needed for validating a UK postcode, so i allow all letters and numbers. Google tells me it is a bit more complex, see for example .

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.