saveData after editNewRecord

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']);
    }	
});
//------------------------------------------------------------------------------------

Hello eldadcaspi,

Nothing is obviously wrong. Do you see any warnings in the logs in the Developer Console? Do you see a JavaScript error? What do you see if you set the “xmlBinding” and “RPCManager” log categories to DEBUG level?

Still nothing

I have set “xmlBinding” and “RPCManager” log categories to DEBUG level, but no error or any log messag in the Developer Console. Also, no JavaScript error is displayed on FireFox error console or FiereBug. So I click “Add”, enter the data, click “Save” - and get no messages at all.

I’ve noticed that sometimes (not always) I get this strange JavaScript error when I move the mouse over the records in the ListGrid, can this be related?

[Exception... "'Permission denied to get property XULElement.accessKey' when calling method: [nsIDOMXULLabelElement::accessKey]"  nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: http://localhost/projects/SmartClient_57_SmallVendor/smartclientRuntime/isomorphic/system/modules/ISC_Core.js :: anonymous :: line 532"  data: no]
http://localhost/projects/SmartClient_57_SmallVendor/smartclientRuntime/isomorphic/system/modules/ISC_Core.js
Line 532

Hello eldadcaspi,

That’s very odd, as either the save should proceed or there should be an error. No one has ever reported either this problem or the bogus error about accessKeys.

Is it possible you are running a beta version of Firefox, or using some unusual Firefox extensions?

Are you able to reproduce this problem in any other browser or on any other machine?

If so, if you could isolate the problem into a self-contained test case (see the advice on Issue Reports under Debugging), we should be able to resolve it quickly.

I’m running FireFox 2.0.07, and I have the same problem on IE 6.

I’ve put together a ZIP with the related files that can run stand alone, here:
http://www.pixtrix.co.il/ilya/SmartClient.rar

Thanks for your help

The problem here is that your editForm contains a required, hidden field “lID”.

When editing an existing record, the form has a value for this field, so validation is successful and saving succeeds.

However, when editing a new record, the form has no value for this field and the user has no way to enter one, so the required field always fails validation.
Since the field isn’t visible to the user, the validation failure is not displayed so you see the save fail silently.

You will need to fix this by either providing a value for this field on the front end (for example passing a value into the ‘editNewRecord()’ call), or by removing the field from the form / making it not ‘required’, and handle populating it with data on the back end.
Note that in our demo app we resolve this issue by making the primary key field be type ‘sequence’ rather than ‘integer’, and relying on the back end to populate new records with the appropriate values.

One other thing I noticed in your application was that you have a number of trailing commas after the last item in your array definitions - for example in the children arrays within your adminMenu tree.
This will create an empty slot at the end of the array which may cause you problems later.

I hope this makes sense - let us know if you need more information
Thanks
Isomorphic Software