value "null" is sent in place to "" by textItem, Why?

Hi,

When my user clears the textbox, the value sent to server by SmartClient is “null” in place of “” (empty string).

I want to send empty string to server when there is no value in textItem of Dynamic Form.

One surprising thing is that for some of the textItem fields it sends “” and for some other textItem fields in same Dynamic Form it sends “null”, not able to understand whats the deciding factor.

I even tried setting defaultValue property of textItem, but to no use. Please help.

Below is the sample problem code:
In below code, if all fields are empty, the value smartclient sends to server are as follows (got them through firebig):
mobile_phone – “null”
home_phone – “null”
office_phone – “”
fax – “”

Why this difference?

isc.RestDataSource.create({
    ID:"mp_vep_MyContactDetails_DS",
    fields:[
        {
			type:"TextItem", 
			title:"Mobile Phone", 
			ID:"myMobilePhoneTextbox", 
			defaultValue:"",
			name:"mobile_phone", 
			disabled:false, 
		},
        {
			type:"TextItem", 
			title:"Home Phone", 
			ID:"myHomePhoneTextbox", 
			defaultValue:"test",
			name:"home_phone", 
			disabled:false, 
		},
        {
			type:"TextItem", 
			title:"Office Phone", 
			ID:"myOfficePhoneTextbox", 
			defaultValue:"",
			name:"office_phone", 
			disabled:false, 
		},
        {
			type:"TextItem", 
			title:"Fax Number", 
			ID:"myfaxTextbox", 
			defaultValue:"",
			name:"fax", 
			disabled:false, 
		}
    ],
    dataFormat:"json",
    fetchDataURL:"restcalls/data_operations/function/fetchContactDetailsInfo",
    updateDataURL:"restcalls/data_operations/function/updateContactDetailsInfo"
})

Below is the firebug output:

_componentId	myContactDetailsForm

_dataSource	mp_vep_MyContactDetails_DS

_oldValues	{
		    "mobile_phone":"+91-xxx-257xxx", 
		    "home_phone":"+91-yyy-257yyy", 
		    "office_phone":"", 
		    "fax":""
		}

_operationType	update

fax	

home_phone	null

mobile_phone	null

office_phone

I am waiting for some responses on this post.
Please help.
I am stuck with my development just due to this issue.
If someone know the reason and solution, please share.

Gaurav

Look at the oldValues. Those fields had an initial value of “” so they retained that value. The others were unset so they are being sent as null. If this distinction doesn’t matter for your server (it does for some), override transformRequest() to encode these two things in the same way.