tags:

views:

309

answers:

2

I'm trying to make a DateTextBox that submits data once a date is selected. To do that I have this code: <form action="timecard/setViewDate" method="post" id="timespan" dojoType="dijit.form.Form"> <input type="text" name="calendar" value="2009-09-28" id="calendar" dojoType="dijit.form.DateTextBox" onchange="doTimechangeSubmit" /> </form> and the onchange function is: function doTimechangeSubmit() { var thisdialog = new dijit.Dialog({ title: "Please Wait...", content: "We are wasting some time.", id: 'stupidWasteOfTime'}); dojo.body().appendChild(thisdialog.domNode); thisdialog.startup(); thisdialog.show(); setTimeout("dojo.byId('timespan').submit();",1000); dojo.byId('timespan').submit(); }

I have this function because without waiting a bit the value I receive is the date the widget starts with. I hate this and I'm just waiting for a slow response to break it.

My want is to hook the submit function in a place that guarantees I get the value the user actually selected. Anybody have any ideas?

A: 

Change dojo.byId('timespan').submit(); to dijit.byId('timespan').submit();

For an explanation read this.

Lawrence Barsanti
Nope doesn't do anything different I still need the Timeout to slow down the submission for the dijit's logic.
David
Hmm. That's confusing. Actually, both are valid yet they do slightly different things. The first calls submit() on the DOM FORM element -- which should work fine -- and the latter calls submit() on the dijit.form.Form element which ends up calling the same native method but does some validity checking.
peller
er, I meant the latter calls submit on the dijit.form.Form *widget* object, as opposed to the DOM element.
peller
+1  A: 

This is fixed in Dojo 1.4. Refer to ticket #9566.

Doug