You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vincent Lin <vi...@gmail.com> on 2007/06/07 11:35:10 UTC

[s2] How to get the value of dojo datetimepicker object

I am trying to get the value inputed by the user from datetimepicker object.
I have the following javascript in my JSP:

        var obj = dojo.widget.byId("createTimeTm");
        alert(obj);
        alert(obj.getValue());

But "alert(obj.getValue())" encounter a javsacript error.

Can anyone tell me the correct syntax of the javascript to retrieve the
value of datetimepicker object?

Thanks!

Re: [s2] How to get the value of dojo datetimepicker object

Posted by Vincent Lin <vi...@gmail.com>.
Thanks Musachy, it works.
The javascript error I had is caused by wrong element id.

But it's wierd that when I used the wrong id, the alert(obj) give me a dojo
object name.
When I call obj.gatValue(), I got a javascript error.

On 6/7/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> The setter methods are specific to 2.1, but the getter ones are available
> on
> 2.0.x:
>
>
> http://struts.apache.org/2.x/docs/ajax-and-javascript-recipes.html#AjaxandJavaScriptRecipes-DateandTimepicker
>
> musachy
>
> On 6/7/07, Musachy Barroso <mu...@gmail.com> wrote:
> >
> > I posted this not long ago on this list. Basically you have to use
> > "getDate()" to get a JavaScript date object and getValue() to get the
> text
> > entered in the datepicker.
> >
> > musachy
> >
> > On 6/7/07, Vincent Lin <vi...@gmail.com> wrote:
> > >
> > > I am trying to get the value inputed by the user from datetimepicker
> > > object.
> > > I have the following javascript in my JSP:
> > >
> > >         var obj = dojo.widget.byId("createTimeTm");
> > >         alert(obj);
> > >         alert( obj.getValue());
> > >
> > > But "alert(obj.getValue())" encounter a javsacript error.
> > >
> > > Can anyone tell me the correct syntax of the javascript to retrieve
> the
> > > value of datetimepicker object?
> > >
> > > Thanks!
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>

Re: [s2] How to get the value of dojo datetimepicker object

Posted by Musachy Barroso <mu...@gmail.com>.
The setter methods are specific to 2.1, but the getter ones are available on
2.0.x:

http://struts.apache.org/2.x/docs/ajax-and-javascript-recipes.html#AjaxandJavaScriptRecipes-DateandTimepicker

musachy

On 6/7/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> I posted this not long ago on this list. Basically you have to use
> "getDate()" to get a JavaScript date object and getValue() to get the text
> entered in the datepicker.
>
> musachy
>
> On 6/7/07, Vincent Lin <vi...@gmail.com> wrote:
> >
> > I am trying to get the value inputed by the user from datetimepicker
> > object.
> > I have the following javascript in my JSP:
> >
> >         var obj = dojo.widget.byId("createTimeTm");
> >         alert(obj);
> >         alert( obj.getValue());
> >
> > But "alert(obj.getValue())" encounter a javsacript error.
> >
> > Can anyone tell me the correct syntax of the javascript to retrieve the
> > value of datetimepicker object?
> >
> > Thanks!
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd




-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: [s2] How to get the value of dojo datetimepicker object

Posted by Musachy Barroso <mu...@gmail.com>.
I posted this not long ago on this list. Basically you have to use
"getDate()" to get a JavaScript date object and getValue() to get the text
entered in the datepicker.

musachy

On 6/7/07, Vincent Lin <vi...@gmail.com> wrote:
>
> I am trying to get the value inputed by the user from datetimepicker
> object.
> I have the following javascript in my JSP:
>
>         var obj = dojo.widget.byId("createTimeTm");
>         alert(obj);
>         alert(obj.getValue());
>
> But "alert(obj.getValue())" encounter a javsacript error.
>
> Can anyone tell me the correct syntax of the javascript to retrieve the
> value of datetimepicker object?
>
> Thanks!
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd