Hello, I have a ListGrid and a DynamicForm to edit details of a record, almost exactly the same as in the demo app of Office Suply in the online documentation. Both the ListGrid and the DynamicForm are bound to one DataSource.
The “fetch” and “update” operations are working fine, but when I add a new record with “editForm.editNewRecord()”, fill the empty form and press the save button - “editForm.SaveData()”, the form passes the validation, but no call to the add page is made (I can see it in FireBug that no XML request is made). What is wrong? See the attached code,
Thank you.
//------------------------------------------------------------------------------------
// admin users list
DataSource.create({
ID:"adminsDS",
operationBindings:[
{operationType:"fetch",
dataFormat:"xml",
recordXPath:"//ADMIN",
dataURL:"XML/AdminsListXML.asp?sOperation=<%=XHR_FETCH%>&bIsActiveOnly=0"},
{operationType:"add",
dataFormat:"xml",
recordXPath:"//ADMIN",
dataURL:"XML/AdminsListXML.asp?sOperation=<%=XHR_ADD%>"},
{operationType:"update",
dataFormat:"xml",
recordXPath:"//ADMIN",
dataURL:"XML/AdminsListXML.asp?sOperation=<%=XHR_UPDATE%>"},
{operationType:"remove",
dataFormat:"xml",
recordXPath:"//ADMIN",
dataURL:"XML/AdminsListXML.asp?sOperation=<%=XHR_REMOVE%>"},
],
fields:[
{name:"lID", title:"ID", width:40, type:"integer", primaryKey:"true"},
{name:"sUserName", title:"UserName", type:"text"},
{name:"lAdminTypeID", title:"AdminTypeID", hidden:"true", type:"integer"},
{name:"sAdminType", title:"Type", type:"text"},
{name:"lRoleID", title:"RoleID", hidden:"true", type:"integer"},
{name:"sRoleName", title:"Role", type:"text"},
{name:"lAdminSiteID", title:"AdminSiteID", hidden:"true", type:"integer"},
{name:"sSiteName", title:"Site", type:"text"},
{name:"lAgencyID", title:"AgencyID", hidden:"true", type:"integer"},
{name:"sAgencyName", title:"Agency", type:"text"},
{name:"lAdvertiserID", title:"AdvertiserID", hidden:"true", type:"integer"},
{name:"sAdvertisierName", title:"Advertiser", type:"text"},
{name:"lCampaignID", title:"CampaignID", hidden:"true", type:"integer"},
{name:"sCampaignName", title:"Campaign", type:"text"},
{name:"bIsActive", title:"Active", width:50,
align:"center", type:"integer", valueMap:{"0":false, "1":true},
valueIcons:{"1":"../../img/true.png","0":"../../img/false.png"}}
]
});
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
// admin user edit form
isc.DynamicForm.create({
ID:"editForm",
dataSource:"adminsDS",
fields:[
{ID:"lID", name:"lID", title:"ID", required:true, type:"hidden"},
{ID:"sUserName", name:"sUserName", title:"UserName", required:true,
validators:[{type:"lengthRange", min:6, max:250}]},
{ID:"sPassword", name:"sPassword", title:"Password", required:true,
validators:[{type:"lengthRange", min:6, max:250}]},
{ID:"sEmail", name:"sEmail", title:"Email", required:true,
validators:[{type:"regexp", expression:"^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$"}]},
{ID:"lAdminTypeID", name:"lAdminTypeID", title:"Type", editorType:"SelectItem", required:true,
optionDataSource:"typesDS", displayField:"sTypeName", valueField:"lID",
changed:"setFormSelects(value)"},
{ID:"lRoleID", name:"lRoleID", title:"Role", editorType:"SelectItem", required:true,
optionDataSource:"rolesDS", displayField:"sRoleName", valueField:"lID"},
{ID:"lAdminSiteID", name:"lAdminSiteID", title:"Site", editorType:"SelectItem",
optionDataSource:"sitesDS", displayField:"sSiteName", valueField:"lID"},
{ID:"lAgencyID", name:"lAgencyID", title:"Agency", editorType:"SelectItem",
optionDataSource:"agenciesDS", displayField:"sAgencyName", valueField:"lID"},
{ID:"lAdvertiserID", name:"lAdvertiserID", title:"Advertiser", editorType:"SelectItem",
optionDataSource:"advertisersDS", displayField:"sAdvertisierName", valueField:"lID"},
{ID:"lCampaignID", name:"lCampaignID", title:"Campaign", editorType:"SelectItem",
optionDataSource:"campaignsDS", displayField:"sCampaignName", valueField:"lID"},
{ID:"bIsActive", name:"bIsActive", title:"Active", align:"left", editorType:"CheckboxItem"},
{name:"savebtn", editorType:"button", align:"right",
width:100, colSpan:6, title:"Save", click:"editForm.saveData()"},
{name:"addbtn", editorType:"button", align:"right",
width:100, colSpan:6, title:"Add", click:"editForm.editNewRecord({bIsActive:1})"}
],
width:650,
numCols:6,
colWidths:[100,200,100,200],
margin:25,
cellPadding:5,
autoFocus:false
});
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
// admin users list - GRID
isc.ListGrid.create({
ID: "adminsList",
dataSource: adminsDS,
autoFetchData: false,
filterOnKeypress:false,
alternateRecordStyles:true,
showAllRecords:false,
wrapCells:true,
fixedRecordHeights:false,
canReorderFields:true,
leaveScrollbarGap: false,
sortFieldNum: 1,
sortDirection: "ascending",
showHeader: true,
showFilterEditor: true,
selectionType:"single",
emptyCellValue:"--" ,
booleanFalseImage:"../../img/false.png",
booleanTrueImage:"../../img/true.png",
suppressValueIcon:false,
recordClick:"this.updateDetails()",
updateDetails : function () {
var record = this.getSelectedRecord();
editForm.editRecord(record);
setFormSelects(record['lAdminTypeID']);
}
});
//------------------------------------------------------------------------------------