Datepicker 1/1/1900 after form clear

My form:

[code] {
view:“form”,
id:“newMtaskForm”,
scroll: “y”,
elements:[
{
cols:[
{
view: ‘button’,
label: ‘Back’,
click: returnToMtaskView,
id: ‘returnToMtaskView1’,
type:‘prev’,
align:‘left’
},
{
view: ‘button’,
label: ‘Save’,
click: SaveNewMarketingTask,
id: ‘SaveNewMarketingTask’,
align:‘right’
}

					],
					type:"clean"
				},
				{
					view:"layout", 
					id:"newMtaskLayout",
					scroll:"y",
					rows:[
						{ view: 'richselect', name: '', label: 'Type', value: '0', id: 'newMtaskType', datatype: 'json', labelWidth:80, url: './data/marketingtask.new.type.json', on:{'onchange': newMtaskTypeResultChange}},
						{ view: 'richselect', name: '', label: 'Type Details', hidden: true, id: 'newMtaskTypeDetail', labelWidth:120},
						{ view: 'datepicker', name: '', label: 'Due Date', id: 'newMtaskDueDateDetail', labelWidth:100, startOnMonday: false, dateFormat:"%m/%d/%Y", value: (new Date())}
					]
				}[/code]

Javascript I’m attemption to execute:

$$('newMtaskForm').clear(); $$('newMtaskDueDateDetail_calendar').setValue(new Date()); $$('newMtaskForm').show();

I get the error:
07-24 10:58:18.022: E/Web Console(25217): Uncaught TypeError: Cannot call method ‘setValue’ of undefined at file:///android_asset/www/shared.js:749

I’ve already read the other post from 2010 on this topic but it doesn’t appear DHTMLX Touch has the “newMtaskDueDateDetail_calendar” object. How do I set the datepicker’s date to the current date?

I solved my own problem by changing the order of the javascript to:

$$('newMtaskForm').clear(); $$('newMtaskForm').show(); $$('newMtaskDueDateDetail').setValue(new Date());