View Full Version : Changing Forms From Selections

16 Jul 2010, 10:06 AM
Is it possible to change a form based on the information being introduced?. For example if I have a Xtype:'select', and depending on which fields the user choose, I want to add other fields to the same form.

18 Jul 2010, 9:24 PM
Here's a short sample:

icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function(){

var formBase = {
scroll: 'vertical',

items: [{
xtype: 'select',
name: 'rank',
label: 'Rank',
listeners: {
buffer: 50,
change: function(field, value){
var ct = field.ownerCt;
if(value == 'padawan'){
xtype: 'textfield',
fieldLabel: 'Padawan field'
var items = ct.items;
if (items.getCount() > 1) {
options: [{
text: 'Master',
value: 'master'
}, {
text: 'Student',
value: 'padawan'

if (Ext.platform.isAndroidOS) {
xtype: 'component',
styleHtmlContent: true,
html: '<span style="color: red">Forms on Android are currently under development. We are working hard to improve this in upcoming releases.</span>'

if (Ext.platform.isPhone) {
formBase.fullscreen = true;
} else {
Ext.apply(formBase, {
autoRender: true,
floating: true,
modal: true,
centered: true,
hideOnMaskTap: false,
height: 385,
width: 480

var form = new Ext.form.FormPanel(formBase);

19 Jul 2010, 2:42 AM
Can I do some thing after form has rendered.I have a problem I have a form with country drop down and i have to select some country. problem is that country list come form ajax call after populating i have another ajax call which selects the drop down country. but both ajax call occur at same time So no item is select. Plz help.