Tina G
5 Oct 2007, 4:11 AM
My servlet is returning the supported languages and based on this information, I need to add radio buttons to my form.
.js file:
var playInstanceDlg;
var supportedLanguageIndex = 0;
if (!playInstanceDlg) {
playInstanceDlg = createNewPlayDialog("a-playInstance-dlg");
playInstanceDlg.addButton('Submit', function() {
while (supportedLanguageIndex < '<%= request.getSession().getAttribute("totalLanguageCount") %>') {
var label = '<%= request.getSession().getAttribute("supportedLanguages").get(supportedLanguageIndex) %>';
//var label = supportedLanguages.get[supportedLanguageIndex];
alert('label : '+label);
var field=new Ext.form.Radio({
fieldLabel: label,
name: language,
checked: false
});
form_instance_play.add(field);
++supportedLanguageIndex;
};
if (form_instance_play.isValid()) {
form_instance_play.submit({
waitMsg:'Submitting the selected language to server ...',
failure: function(form_instance_play, action) {
playInstanceDlg.hide();
},
success: function(form_instance_play, action) {
playInstanceDlg.hide();
}
});
}
});
}
else
Ext.MessageBox.alert('Errors', 'Please fix the errors.');
var layout = playInstanceDlg.getLayout();
layout.beginUpdate();
layout.add('center', new Ext.ContentPanel('a-playInstance-inner', {title: 'Select Language'}));
layout.endUpdate();
playInstanceDlg.show();
}
}
Let me know in case there are any existing examples of the same on the forum.
.js file:
var playInstanceDlg;
var supportedLanguageIndex = 0;
if (!playInstanceDlg) {
playInstanceDlg = createNewPlayDialog("a-playInstance-dlg");
playInstanceDlg.addButton('Submit', function() {
while (supportedLanguageIndex < '<%= request.getSession().getAttribute("totalLanguageCount") %>') {
var label = '<%= request.getSession().getAttribute("supportedLanguages").get(supportedLanguageIndex) %>';
//var label = supportedLanguages.get[supportedLanguageIndex];
alert('label : '+label);
var field=new Ext.form.Radio({
fieldLabel: label,
name: language,
checked: false
});
form_instance_play.add(field);
++supportedLanguageIndex;
};
if (form_instance_play.isValid()) {
form_instance_play.submit({
waitMsg:'Submitting the selected language to server ...',
failure: function(form_instance_play, action) {
playInstanceDlg.hide();
},
success: function(form_instance_play, action) {
playInstanceDlg.hide();
}
});
}
});
}
else
Ext.MessageBox.alert('Errors', 'Please fix the errors.');
var layout = playInstanceDlg.getLayout();
layout.beginUpdate();
layout.add('center', new Ext.ContentPanel('a-playInstance-inner', {title: 'Select Language'}));
layout.endUpdate();
playInstanceDlg.show();
}
}
Let me know in case there are any existing examples of the same on the forum.