Skip to content

Instantly share code, notes, and snippets.

@jeffremer
Created February 10, 2011 23:24
Show Gist options
  • Save jeffremer/821596 to your computer and use it in GitHub Desktop.
Save jeffremer/821596 to your computer and use it in GitHub Desktop.
{
index: function(interaction) {
var form = new Wbx.views.form.FormPanel({
defaults: {
labelAlign: 'top',
labelWidth: '100%'
},
items: [
{
xtype: 'textfield',
name : 'first',
label: 'First name'
},
{
xtype: 'textfield',
name : 'last',
label: 'Last name'
},
{
xtype: 'numberfield',
name : 'age',
label: 'Age'
},
{
xtype: 'urlfield',
name : 'url',
label: 'Website'
}
]
});
var button = new Wbx.views.Button({
text:'Test',
scope: this,
handler: function() {
var data = form.getValues();
form.getFields('first').addCls('error');
if(everythingisok) {
this.submitData(data);
}
}
});
form.add(button);
var panel = new Wbx.views.AbstractView({
items: [form],
});
this.renderIndex(panel, interaction);
},
submitData: function(data) {
Ext.util.JSONP.request({
url: 'someURL',
callbackKey: 'callback',
params: {
name: data.first + " " data.last,
age: data.age,
url: data.url
},
callback: function(result) {
if(result.success) {
alert("success");
}
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment