O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Combining form fields

Every now and then we may want to group a set of related fields together and present them with one label. This example aims to show you how to make a form that combines three number fields (separated by hyphens) for gathering a UK banking sort code.

This will gather the three parts of the sort code as separate fields and present it in a user friendly manner to the user.

Getting ready

As this recipe is a form to collect a UK bank account number and sort code we have written a custom VType for the sort code. If you are not already familiar with how to write or use a VType you'll find the two recipes in Chapter 5, Loading, Submitting, and Validating Forms, useful. The code for this VType is shown as follows:

Ext.apply(Ext.form.field.VTypes, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required