1. the SmartGWT or SmartClient version and browser version(s) involved;
Power 2.3 and Firefox 3.6.
I'm trying to join table data in a form using the database tables ACCOUNT, CONTACT_INFORMATION and ADDRESS.
Fetching data works okay. But trying to add new data fails and updating existing data is only updating the primary table which is ACCOUNT. The Address data is not being updated.
When I try and create a new entry using the DynamicForm, I get the error message "mysql can't handle more than one auto_increment primary_key".
When I try and update an existing entry using the DynamicForm, the ACCOUNT data updates correctly in the database, but the ADDRESS data doesn't update at all.
ACCOUNT, CONTACT, ADDRESS are the primary keys of the tables as well as being auto_increment columns (mysql).
Any help is greatly appreciated.
Here is my code for the datasource and the dynamicform -
Power 2.3 and Firefox 3.6.
I'm trying to join table data in a form using the database tables ACCOUNT, CONTACT_INFORMATION and ADDRESS.
Fetching data works okay. But trying to add new data fails and updating existing data is only updating the primary table which is ACCOUNT. The Address data is not being updated.
When I try and create a new entry using the DynamicForm, I get the error message "mysql can't handle more than one auto_increment primary_key".
When I try and update an existing entry using the DynamicForm, the ACCOUNT data updates correctly in the database, but the ADDRESS data doesn't update at all.
ACCOUNT, CONTACT, ADDRESS are the primary keys of the tables as well as being auto_increment columns (mysql).
Any help is greatly appreciated.
Here is my code for the datasource and the dynamicform -
Code:
isc.DataSource.create({ ID:"account", dataFormat:"iscServer", dbName:"RIVERS", serverType:"sql", tableName:"account", fields:{ ACCOUNT:{ name:"ACCOUNT", primaryKey:true, type:"sequence" }, FULLNAME2:{ length:"125", name:"FULLNAME2", required:true, type:"text" }, CURRENT_BALANCE:{ length:"125", name:"CURRENT_BALANCE", type:"float" }, NOW_DUE:{ length:"125", name:"NOW_DUE", type:"float" }, OVERDUE1:{ length:"125", name:"OVERDUE1", type:"float" }, SPENTRECENT:{ length:"125", name:"SPENTRECENT", type:"float" }, SPENTTOTAL:{ length:"125", name:"SPENTTOTAL", type:"float" }, DATE_ACCOUNT_OPENED:{ length:"125", name:"DATE_ACCOUNT_OPENED", type:"date", displayFormat:"toEuropeanShortDate" }, DATE_ACCOUNT_CLOSED:{ length:"125", name:"DATE_ACCOUNT_CLOSED", type:"date", displayFormat:"toEuropeanShortDate" }, ADDRESS1:{ length:"50", name:"ADDRESS1", type:"text", customSQL:"true", tableName:"address" }, ADDRESS2:{ length:"50", name:"ADDRESS2", type:"text", customSQL:"true", tableName:"address" }, PHONE_NO:{ length:"10", name:"PHONE_NO", type:"text", customSQL:"true", tableName:"address" }, FAX_NO:{ length:"10", name:"FAX_NO", type:"text", customSQL:"true", tableName:"address" }, SALES_CONTACT:{ hidden:true, name:"SALES_CONTACT", customSQL:"true", tableName:"account" }, CONTACT:{ hidden:true, primaryKey:true, type:"sequence", name:"CONTACT", customSQL:"true", tableName:"contact_information" }, ADDRESS:{ name:"ADDRESS", type:"hidden", customSQL:"true", tableName:"contact_information" }, ADDRESS:{ name:"ADDRESS", primaryKey:true, type:"sequence", customSQL:"true", tableName:"address" } }, operationBindings:[ { operationType:"fetch", customCriteriaFields:"SALES_CONTACT,CONTACT,ADDRESS", customValueFields:"ADDRESS,CONTACT,SALES_CONTACT,ADDRESS1,ADDRESS2,PHONE_NO,FAX_NO", tableClause:"account,contact_information,address", whereClause:"account.SALES_CONTACT = contact_information.CONTACT AND contact_information.ADDRESS = address.ADDRESS AND ($defaultWhereClause)" }, { operationType:"update", customCriteriaFields:"ACCOUNT,SALES_CONTACT,CONTACT,ADDRESS", customValueFields:"ADDRESS,CONTACT,SALES_CONTACT,ADDRESS1,ADDRESS2,PHONE_NO,FAX_NO", tableClause:"account,contact_information,address", whereClause:"account.SALES_CONTACT = contact_information.CONTACT AND contact_information.ADDRESS = address.ADDRESS AND ($defaultWhereClause)" }, { operationType:"add", customCriteriaFields:"ACCOUNT,SALES_CONTACT,CONTACT,ADDRESS", customValueFields:"ADDRESS,CONTACT,SALES_CONTACT,ADDRESS1,ADDRESS2,PHONE_NO,FAX_NO", tableClause:"account,contact_information,address", whereClause:"account.SALES_CONTACT = contact_information.CONTACT AND contact_information.ADDRESS = address.ADDRESS AND ($defaultWhereClause)" } ], dataSourceVersion:"1", generatedBy:"SC_SNAPSHOT-2010-12-15/EVAL Deployment 2010-12-15" })
Code:
isc.DynamicForm.create({ ID:"EditAccountForm", autoDraw:false, dataSource:"account", disabled:true, fields:[ { name:"ACCOUNT", title:"Account", align:"left", disabled:true, _constructor:"TextItem" }, { name:"FULLNAME2", title:"Name", _constructor:"TextItem" }, { name:"CURRENT_BALANCE", title:"Current Balance", textAlign:"right", align:"left", prompt:"Enter the balance without dollar sign or commas.", hint:"1234.56", mapValueToDisplay:function(form,item,value) { if (this.getValue() == undefined) return ""; return formatCurrency(this.getValue()); }, _constructor:"TextItem" }, { name:"NOW_DUE", title:"Now Due", textAlign:"right", align:"left", prompt:"Enter the balance without dollar sign or commas.", hint:"1234.56", mapValueToDisplay:function(form,item,value) { if (this.getValue() == undefined) return ""; return formatCurrency(this.getValue()); }, _constructor:"TextItem" }, { name:"OVERDUE1", title:"Overdue", textAlign:"right", align:"left", prompt:"Enter the balance without dollar sign or commas.", hint:"1234.56", mapValueToDisplay:function(form,item,value) { if (this.getValue() == undefined) return ""; return formatCurrency(this.getValue()); }, _constructor:"TextItem" }, { name:"SPENTRECENT", title:"Spent Recent", textAlign:"right", align:"left", prompt:"Enter the balance without dollar sign or commas.", hint:"1234.56", mapValueToDisplay:function(form,item,value) { if (this.getValue() == undefined) return ""; return formatCurrency(this.getValue()); }, _constructor:"TextItem" }, { name:"SPENTTOTAL", title:"Spent Total", textAlign:"right", align:"left", prompt:"Enter the balance without dollar sign or commas.", hint:"1234.56", mapValueToDisplay:function(form,item,value) { if (this.getValue() == undefined) return ""; return formatCurrency(this.getValue()); }, _constructor:"TextItem" }, { name:"DATE_ACCOUNT_OPENED", title:"Date Account Opened", align:"left", prompt:"Enter the date on which the account was opened", hint:"31/12/2010", useTextField:true, _constructor:"DateItem" }, { name:"DATE_ACCOUNT_CLOSED", title:"Date Account Closed", align:"left", validateOnChange:true, prompt:"Enter the date on which the account was closed", hint:"31/12/2010", showErrorStyle:true, useTextField:true, invalidDateStringMessage:"Invalid date format", _constructor:"DateItem" }, { name:"ADDRESS1", title:"Address Line 1", _constructor:"TextItem" }, { name:"ADDRESS2", title:"Address Line 2", _constructor:"TextItem" }, { name:"PHONE_NO", title:"Phone No", mask: "(##)####-####", _constructor:"TextItem" }, { name:"FAX_NO", title:"Fax No", mask: "(##)####-####", _constructor:"TextItem" } ], height:500 })
Comment