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

Creating repeatable form fields and fieldsets

It is sometimes necessary to gather repeating data from a user. For example, a booking form (for a hotel, restaurant, or attraction) sometimes requires the total number of guests and information about each individual. More often than not these questions are the same for each person.

This example will demonstrate how to create a form panel with a set of repeating questions. The repeated questions will be dynamically added to the form by pressing an Add Another Guest button. The fields will sit inside a FieldSet that has reference to the number of repeated items.

How to do it...

  1. Start by creating a form panel and rendering it to the document's body:
    var formPanel = Ext.create('Ext.form.Panel', { title: 'Reservation ...

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