pwgustafson
27 Sep 2010, 12:52 PM
How do I access form elements when doing an ajax request?
MY FORM:
demos.GetCustomerRepExtension = new Ext.form.FormPanel({
scroll: 'vertical',
items: [{
xtype: 'fieldset',
title: 'Input Parameters',
instructions: 'Please enter the information above.',
items: [{
xtype: 'textfield',
id: 'search_no',
name: 'search_no',
label: 'Number',
placeholder: 'search_no',
},
{
xtype: 'select',
name: 'search_type',
label: 'Type',
options: [{
text: 'Account',
value: 'ACCOUNT'
},
{
text: 'Phone',
value: 'PHONE'
}]
},
{
xtype: 'select',
name: 'ext_type',
label: 'Type',
options: [{
text: 'Sales',
value: 'SALES'
}]
}
]
},
{
xtype: 'button',
ui: 'action',
text: 'Execute',
handler: buttonHandler
}/]//End Items
});//End Form Panel
MY REQUEST:
var buttonHandler = function(button,event) {
Ext.Ajax.request({
url: 'ajax/ajax_GetCustomerRepExt.php',
params:{
FORM VALUES HERE
},
success: function(response, opts) {
alert(demos.GetCustomerRepExtension.items.items[0]);
}
})
};
What is the best way to get the values of the form fields and pass them through to the AJAX request.
Thanks.
MY FORM:
demos.GetCustomerRepExtension = new Ext.form.FormPanel({
scroll: 'vertical',
items: [{
xtype: 'fieldset',
title: 'Input Parameters',
instructions: 'Please enter the information above.',
items: [{
xtype: 'textfield',
id: 'search_no',
name: 'search_no',
label: 'Number',
placeholder: 'search_no',
},
{
xtype: 'select',
name: 'search_type',
label: 'Type',
options: [{
text: 'Account',
value: 'ACCOUNT'
},
{
text: 'Phone',
value: 'PHONE'
}]
},
{
xtype: 'select',
name: 'ext_type',
label: 'Type',
options: [{
text: 'Sales',
value: 'SALES'
}]
}
]
},
{
xtype: 'button',
ui: 'action',
text: 'Execute',
handler: buttonHandler
}/]//End Items
});//End Form Panel
MY REQUEST:
var buttonHandler = function(button,event) {
Ext.Ajax.request({
url: 'ajax/ajax_GetCustomerRepExt.php',
params:{
FORM VALUES HERE
},
success: function(response, opts) {
alert(demos.GetCustomerRepExtension.items.items[0]);
}
})
};
What is the best way to get the values of the form fields and pass them through to the AJAX request.
Thanks.