View Full Version : Problem with passing id value in combobox

7 Feb 2010, 8:54 AM

How can i pass ID of my value in combobox to my query?
Basicly i have an relation between First and second table. It looks like this:

ID [int 11 primary]
TEST [varchar25]
ID_SECOND_TABLE[int 11 secondary]

Second Table
ID_SEC [INT 11 primary]
TEST_2 [varchar25]

Now, when im try to pass a value from Second_Table in combo box to First_Table it always save value of record TEST_2 not ID_SEC.

Please solve my problem

7 Feb 2010, 11:32 AM
setup the baseParams of the store to pass the id.

7 Feb 2010, 12:11 PM
noob question: How?
Here is my data store helper

var data = new Ext.data.JsonStore({
url: 'action.php',
baseParams: {???},
root: 'items',
idProperty: 'id_sec',
fields: ['id_sec', 'test_2']

Here is my combobox definition

items: [{
xtype: 'combo',
fieldLabel: 'Help',
emptyText: 'Help',
allowEmpty: false,
triggerAction: 'all',
typeAhead: true,
name: 'id_second_table',

mode: 'remote',
minChars: 3,
store: data,
valueField: 'id_sec',
displayField: 'test_2'

Here is sample query

$result = mysql_query ("INSERT INTO first_table (id_second_table) VALUES ('".$_POST['id_second_table']."'));

7 Feb 2010, 12:13 PM
baseParams: { id : 9999 },
Are you looking to modfy the base params on the fly when the item is selected? I'm confused

7 Feb 2010, 12:25 PM

I want to make combobox with remote sorting, that will by pass record id to another table.
The combobox should have blockade, prevents sending another values not stored in my database.
I guess checkig value with is_numeric('') function will be fine, but still dont know how to setup Yours baseparams

The combo box will be store a large amount of data so, it should have remote sorting.
I hope you know what i mean. Sorry for my bad gramma