Skip to content

Instantly share code, notes, and snippets.

@digibutt
Created February 11, 2012 09:32
Show Gist options
  • Save digibutt/1798254 to your computer and use it in GitHub Desktop.
Save digibutt/1798254 to your computer and use it in GitHub Desktop.
Sloth in a box
var form = new Ext.form.FormPanel({
layout: 'form'
,title: "Sloth in a box ltd. <em>Sloth Inventory Management System 2.0</em>"
,labelWidth: 200
,labelPad: 20
,labelAlign: 'right'
,bodyStyle: {
padding: '20px 0'
}
,items: [
{
xtype: "textfield"
,fieldLabel: "Name of Sloth"
,name: "name"
,required: true
}
,{
xtype: "combo"
,fieldLabel: "Relative speed of Sloth"
,name: "speed"
,required: true
,mode: 'local'
,store: new Ext.data.ArrayStore({
id: 0
,fields: [
'speed'
]
,data: [['One legged turtle'], ['Salted slug'], ['Usain Bolt Swimming']]
})
,displayField: 'speed'
,valueField: 'speed'
,editable: false
,triggerAction: 'all'
}
,{
xtype: "checkbox"
,fieldLabel: "Is covered in own faeces?"
,name: "isFaecal"
,value: 1
}
,{
xtype: "numberfield"
,fieldLabel: "Price of sloth"
,name: "price"
,required: true
}
]
,bbar: [
'->'
,{
xtype: 'button'
,text: 'Save sloth'
,handler: function(){
form.fireEvent('submit')
}
}
]
,renderTo: 'page'
,listeners: {
submit: function(){
alert("Sloth has been published on slothinabox.com");
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment