You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Reshmi <ra...@trinitymobility.com> on 2012/04/24 14:33:15 UTC

problem in hiding timepicker of struts jquery datetimepicker

Hi all,

My codes for date time picker is

 

<sj:datepicker timepicker="true" readonly="true" label="From Date"
id="fromdate" name="fromdate" displayFormat="dd-mm-yy"
timepickerShowSecond="true"  timepickerFormat="hh:mm:ss"></sj:datepicker>

                        <sj:datepicker timepicker="true" readonly="true"
label="To Date" id="todate" name="todate" displayFormat="dd-mm-yy"
timepickerShowSecond="true" timepickerFormat="hh:mm:ss" ></sj:datepicker>

 

 

I want to display timepicker only for some cases

For that I put javascript function like this.

 

 

 

if(select1=="A")

              {

             

 

              

              document.getElementById("fromdate").timepicker=false;

              document.getElementById("todate").timepicker=false;

              }

        else 

              {

              

              document.getElementById("fromdate").timepicker=true;

              document.getElementById("todate").timepicker=true;

              

              }

 

But this is not working for for me.Any one can help me?How can I implement
it?

 

Best Regards,

Reshmi

Software Engineer | Trinity Mobility Pvt. Ltd. | Bangalore|+91-8971512535| 

trinity-logo_small

 

 


RE: problem in hiding timepicker of struts jquery datetimepicker

Posted by "Edward W. Rouse" <er...@comsquared.com>.
Datepicker has a show/hide option. Look under methods.

 

http://jqueryui.com/demos/datepicker/

 

From: Reshmi [mailto:rasmi@trinitymobility.com] 
Sent: Tuesday, April 24, 2012 8:33 AM
To: 'Struts Users Mailing List'
Subject: problem in hiding timepicker of struts jquery datetimepicker

 

Hi all,

My codes for date time picker is

 

<sj:datepicker timepicker="true" readonly="true" label="From Date"
id="fromdate" name="fromdate" displayFormat="dd-mm-yy"
timepickerShowSecond="true"  timepickerFormat="hh:mm:ss"></sj:datepicker>

                        <sj:datepicker timepicker="true" readonly="true"
label="To Date" id="todate" name="todate" displayFormat="dd-mm-yy"
timepickerShowSecond="true" timepickerFormat="hh:mm:ss" ></sj:datepicker>

 

 

I want to display timepicker only for some cases

For that I put javascript function like this.

 

 

 

if(select1=="A")

              {

             

 

              

              document.getElementById("fromdate").timepicker=false;

              document.getElementById("todate").timepicker=false;

              }

        else 

              {

              

              document.getElementById("fromdate").timepicker=true;

              document.getElementById("todate").timepicker=true;

              

              }

 

But this is not working for for me.Any one can help me?How can I implement
it?

 

Best Regards,

Reshmi

Software Engineer | Trinity Mobility Pvt. Ltd. | Bangalore|+91-8971512535| 

trinity-logo_small

 

 


Re: problem in hiding timepicker of struts jquery datetimepicker

Posted by Hernán <he...@gmail.com>.
As you are using struts2 jquery plugin, I would use jquery:

<script type="text/javascript">
$(
   function() {
       $("#selectId").change(
          var selectedValue = $(this).val();



       );
   }
);

</script>

On Tue, Apr 24, 2012 at 9:33 AM, Reshmi <ra...@trinitymobility.com> wrote:

>  Hi all,****
>
> My codes for date time picker is****
>
> ** **
>
> <sj:datepicker timepicker=*"true"* readonly=*"true"* label=*"From Date"*
> id=*"fromdate"* name=*"fromdate"* displayFormat=*"dd-mm-yy"*
> timepickerShowSecond=*"true"*  timepickerFormat=*"hh:mm:ss"*></
> sj:datepicker>****
>
>                         <sj:datepicker timepicker=*"true"* readonly=*
> "true"* label=*"To Date"* id=*"todate"* name=*"todate"* displayFormat=*
> "dd-mm-yy"* timepickerShowSecond=*"true"* timepickerFormat=*"hh:mm:ss"*
> ></sj:datepicker>****
>
> ** **
>
> ** **
>
> I want to display timepicker only for some cases****
>
> For that I put javascript function like this.****
>
> ** **
>
> ** **
>
> ** **
>
> *if*(select1=="A")****
>
>               {****
>
>              ****
>
> ** **
>
>               ****
>
>               document.getElementById("fromdate").timepicker=false;****
>
>               document.getElementById("todate").timepicker=false;****
>
>               }****
>
>         *else* ****
>
>               {****
>
>               ****
>
>               document.getElementById("fromdate").timepicker=*true*;****
>
>               document.getElementById("todate").timepicker=*true*;****
>
>               ****
>
>               }****
>
> ** **
>
> But this is not working for for me.Any one can help me?How can I implement
> it?****
>
> ** **
>
> *Best Regards,*
>
> *Reshmi***
>
> *Software Engineer | Trinity Mobility Pvt. Ltd. |
> Bangalore|+91-8971512535| ***
>
> [image: trinity-logo_small]****
>
> ** **
>
> ** **
>



-- 
Hernán

Re: problem in hiding timepicker of struts jquery datetimepicker

Posted by Hernán <he...@gmail.com>.
I understand, well in that case you would have to find the individual DOM
elements you have to hide, as it seems there are no ids for them neither
there are common classes you can try something like this:

$("#timepickerId").find('first-child').hide();
$("#timepickerId").find('nth-child(2)').hide();
$("#timepickerId").find('nth-child(3)').hide();

and your mission is to find the range of nth-child you want to find... I
haven't tried this with this component, but for example I have used with a
jquery dialog, and you can find whatever component you want, for example
the buttons of the dialog.
To be more precise you can apply whatever selector suits best for your
needs I used "#id" you can use ".class" or combine them...
...



On Tue, Apr 24, 2012 at 10:08 AM, Reshmi <ra...@trinitymobility.com> wrote:

> Hi Hernán,
> There is no separate id for date picker and time picker.i am using combined
> datetime picket when I type $("#timePickerId").hide(); like this entire
> datetime picker will hide I want to hide timepicker only.
>
> -----Original Message-----
> From: Hernán [mailto:heamaya@gmail.com]
> Sent: Tuesday, April 24, 2012 6:34 PM
> To: Struts Users Mailing List
> Subject: Re: problem in hiding timepicker of struts jquery datetimepicker
>
> No problem my friend. Try this code to show / hide the datepicker
>
>        $("#checkboxId").click(
>
>                function(event) {
>
>                    if($(this).is(':checked')) {
>                        $("#timePickerId").show();
>                    } else {
>                        $("#timePickerId").hide();
>                    }
>                }
>            );
>
> And this one to enable / disable it.
>
>        $("#checkboxId").click(
>
>                function(event) {
>
>                    if($(this).is(':checked')) {
>                        $("#timePickerId").attr("disabled", "disabled");
>                    } else {
>                        $("#timePickerId").removeAttr("disabled");
>                    }
>                }
>            );
>
>
> On Tue, Apr 24, 2012 at 9:46 AM, Reshmi <ra...@trinitymobility.com> wrote:
>
> > Hi Hernán,
> >
> > Thanks for your quick reply.
> >
> > What my requirement is,
> > Based on the checkbox selection, I need to show/hide the timepicker of
> the
> > datetimepicker.
> >
> >
> >
> >
> > -----Original Message-----
> > From: Hernán [mailto:heamaya@gmail.com]
> > Sent: Tuesday, April 24, 2012 6:10 PM
> > To: Struts Users Mailing List
> > Subject: Re: problem in hiding timepicker of struts jquery datetimepicker
> >
> > As you are using struts2 jquery plugin, I would use jquery:
> >
> > <script type="text/javascript">
> > $(
> >   function() {
> >       $("#selectId").change(
> >          var selectedValue = $(this).val();
> >
> >          if(selectedValue == 'A') {
> >             $("#timePickerId").hide();
> >          }
> >
> >
> >       );
> >   }
> > );
> >
> > </script>
> >
> > Just use show() when you want to...
> > On Tue, Apr 24, 2012 at 9:33 AM, Reshmi <ra...@trinitymobility.com>
> wrote:
> >
> > >  Hi all,****
> > >
> > > My codes for date time picker is****
> > >
> > > ** **
> > >
> > > <sj:datepicker timepicker=*"true"* readonly=*"true"* label=*"From
> Date"*
> > > id=*"fromdate"* name=*"fromdate"* displayFormat=*"dd-mm-yy"*
> > > timepickerShowSecond=*"true"*  timepickerFormat=*"hh:mm:ss"*></
> > > sj:datepicker>****
> > >
> > >                         <sj:datepicker timepicker=*"true"* readonly=*
> > > "true"* label=*"To Date"* id=*"todate"* name=*"todate"* displayFormat=*
> > > "dd-mm-yy"* timepickerShowSecond=*"true"* timepickerFormat=*"hh:mm:ss"*
> > > ></sj:datepicker>****
> > >
> > > ** **
> > >
> > > ** **
> > >
> > > I want to display timepicker only for some cases****
> > >
> > > For that I put javascript function like this.****
> > >
> > > ** **
> > >
> > > ** **
> > >
> > > ** **
> > >
> > > *if*(select1=="A")****
> > >
> > >               {****
> > >
> > >              ****
> > >
> > > ** **
> > >
> > >               ****
> > >
> > >               document.getElementById("fromdate").timepicker=false;****
> > >
> > >               document.getElementById("todate").timepicker=false;****
> > >
> > >               }****
> > >
> > >         *else* ****
> > >
> > >               {****
> > >
> > >               ****
> > >
> > >
> document.getElementById("fromdate").timepicker=*true*;****
> > >
> > >               document.getElementById("todate").timepicker=*true*;****
> > >
> > >               ****
> > >
> > >               }****
> > >
> > > ** **
> > >
> > > But this is not working for for me.Any one can help me?How can I
> > implement
> > > it?****
> > >
> > > ** **
> > >
> > > *Best Regards,*
> > >
> > > *Reshmi***
> > >
> > > *Software Engineer | Trinity Mobility Pvt. Ltd. |
> > > Bangalore|+91-8971512535| ***
> > >
> > > [image: trinity-logo_small]****
> > >
> > > ** **
> > >
> > > ** **
> > >
> >
> >
> >
> > --
> > Hernán
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> --
> Hernán
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Hernán

RE: problem in hiding timepicker of struts jquery datetimepicker

Posted by Reshmi <ra...@trinitymobility.com>.
Hi Hernán,
There is no separate id for date picker and time picker.i am using combined
datetime picket when I type $("#timePickerId").hide(); like this entire
datetime picker will hide I want to hide timepicker only.

-----Original Message-----
From: Hernán [mailto:heamaya@gmail.com] 
Sent: Tuesday, April 24, 2012 6:34 PM
To: Struts Users Mailing List
Subject: Re: problem in hiding timepicker of struts jquery datetimepicker

No problem my friend. Try this code to show / hide the datepicker

        $("#checkboxId").click(

                function(event) {

                    if($(this).is(':checked')) {
                        $("#timePickerId").show();
                    } else {
                        $("#timePickerId").hide();
                    }
                }
            );

And this one to enable / disable it.

        $("#checkboxId").click(

                function(event) {

                    if($(this).is(':checked')) {
                        $("#timePickerId").attr("disabled", "disabled");
                    } else {
                        $("#timePickerId").removeAttr("disabled");
                    }
                }
            );


On Tue, Apr 24, 2012 at 9:46 AM, Reshmi <ra...@trinitymobility.com> wrote:

> Hi Hernán,
>
> Thanks for your quick reply.
>
> What my requirement is,
> Based on the checkbox selection, I need to show/hide the timepicker of the
> datetimepicker.
>
>
>
>
> -----Original Message-----
> From: Hernán [mailto:heamaya@gmail.com]
> Sent: Tuesday, April 24, 2012 6:10 PM
> To: Struts Users Mailing List
> Subject: Re: problem in hiding timepicker of struts jquery datetimepicker
>
> As you are using struts2 jquery plugin, I would use jquery:
>
> <script type="text/javascript">
> $(
>   function() {
>       $("#selectId").change(
>          var selectedValue = $(this).val();
>
>          if(selectedValue == 'A') {
>             $("#timePickerId").hide();
>          }
>
>
>       );
>   }
> );
>
> </script>
>
> Just use show() when you want to...
> On Tue, Apr 24, 2012 at 9:33 AM, Reshmi <ra...@trinitymobility.com> wrote:
>
> >  Hi all,****
> >
> > My codes for date time picker is****
> >
> > ** **
> >
> > <sj:datepicker timepicker=*"true"* readonly=*"true"* label=*"From Date"*
> > id=*"fromdate"* name=*"fromdate"* displayFormat=*"dd-mm-yy"*
> > timepickerShowSecond=*"true"*  timepickerFormat=*"hh:mm:ss"*></
> > sj:datepicker>****
> >
> >                         <sj:datepicker timepicker=*"true"* readonly=*
> > "true"* label=*"To Date"* id=*"todate"* name=*"todate"* displayFormat=*
> > "dd-mm-yy"* timepickerShowSecond=*"true"* timepickerFormat=*"hh:mm:ss"*
> > ></sj:datepicker>****
> >
> > ** **
> >
> > ** **
> >
> > I want to display timepicker only for some cases****
> >
> > For that I put javascript function like this.****
> >
> > ** **
> >
> > ** **
> >
> > ** **
> >
> > *if*(select1=="A")****
> >
> >               {****
> >
> >              ****
> >
> > ** **
> >
> >               ****
> >
> >               document.getElementById("fromdate").timepicker=false;****
> >
> >               document.getElementById("todate").timepicker=false;****
> >
> >               }****
> >
> >         *else* ****
> >
> >               {****
> >
> >               ****
> >
> >               document.getElementById("fromdate").timepicker=*true*;****
> >
> >               document.getElementById("todate").timepicker=*true*;****
> >
> >               ****
> >
> >               }****
> >
> > ** **
> >
> > But this is not working for for me.Any one can help me?How can I
> implement
> > it?****
> >
> > ** **
> >
> > *Best Regards,*
> >
> > *Reshmi***
> >
> > *Software Engineer | Trinity Mobility Pvt. Ltd. |
> > Bangalore|+91-8971512535| ***
> >
> > [image: trinity-logo_small]****
> >
> > ** **
> >
> > ** **
> >
>
>
>
> --
> Hernán
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Hernán


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: problem in hiding timepicker of struts jquery datetimepicker

Posted by Hernán <he...@gmail.com>.
No problem my friend. Try this code to show / hide the datepicker

        $("#checkboxId").click(

                function(event) {

                    if($(this).is(':checked')) {
                        $("#timePickerId").show();
                    } else {
                        $("#timePickerId").hide();
                    }
                }
            );

And this one to enable / disable it.

        $("#checkboxId").click(

                function(event) {

                    if($(this).is(':checked')) {
                        $("#timePickerId").attr("disabled", "disabled");
                    } else {
                        $("#timePickerId").removeAttr("disabled");
                    }
                }
            );


On Tue, Apr 24, 2012 at 9:46 AM, Reshmi <ra...@trinitymobility.com> wrote:

> Hi Hernán,
>
> Thanks for your quick reply.
>
> What my requirement is,
> Based on the checkbox selection, I need to show/hide the timepicker of the
> datetimepicker.
>
>
>
>
> -----Original Message-----
> From: Hernán [mailto:heamaya@gmail.com]
> Sent: Tuesday, April 24, 2012 6:10 PM
> To: Struts Users Mailing List
> Subject: Re: problem in hiding timepicker of struts jquery datetimepicker
>
> As you are using struts2 jquery plugin, I would use jquery:
>
> <script type="text/javascript">
> $(
>   function() {
>       $("#selectId").change(
>          var selectedValue = $(this).val();
>
>          if(selectedValue == 'A') {
>             $("#timePickerId").hide();
>          }
>
>
>       );
>   }
> );
>
> </script>
>
> Just use show() when you want to...
> On Tue, Apr 24, 2012 at 9:33 AM, Reshmi <ra...@trinitymobility.com> wrote:
>
> >  Hi all,****
> >
> > My codes for date time picker is****
> >
> > ** **
> >
> > <sj:datepicker timepicker=*"true"* readonly=*"true"* label=*"From Date"*
> > id=*"fromdate"* name=*"fromdate"* displayFormat=*"dd-mm-yy"*
> > timepickerShowSecond=*"true"*  timepickerFormat=*"hh:mm:ss"*></
> > sj:datepicker>****
> >
> >                         <sj:datepicker timepicker=*"true"* readonly=*
> > "true"* label=*"To Date"* id=*"todate"* name=*"todate"* displayFormat=*
> > "dd-mm-yy"* timepickerShowSecond=*"true"* timepickerFormat=*"hh:mm:ss"*
> > ></sj:datepicker>****
> >
> > ** **
> >
> > ** **
> >
> > I want to display timepicker only for some cases****
> >
> > For that I put javascript function like this.****
> >
> > ** **
> >
> > ** **
> >
> > ** **
> >
> > *if*(select1=="A")****
> >
> >               {****
> >
> >              ****
> >
> > ** **
> >
> >               ****
> >
> >               document.getElementById("fromdate").timepicker=false;****
> >
> >               document.getElementById("todate").timepicker=false;****
> >
> >               }****
> >
> >         *else* ****
> >
> >               {****
> >
> >               ****
> >
> >               document.getElementById("fromdate").timepicker=*true*;****
> >
> >               document.getElementById("todate").timepicker=*true*;****
> >
> >               ****
> >
> >               }****
> >
> > ** **
> >
> > But this is not working for for me.Any one can help me?How can I
> implement
> > it?****
> >
> > ** **
> >
> > *Best Regards,*
> >
> > *Reshmi***
> >
> > *Software Engineer | Trinity Mobility Pvt. Ltd. |
> > Bangalore|+91-8971512535| ***
> >
> > [image: trinity-logo_small]****
> >
> > ** **
> >
> > ** **
> >
>
>
>
> --
> Hernán
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Hernán

RE: problem in hiding timepicker of struts jquery datetimepicker

Posted by Reshmi <ra...@trinitymobility.com>.
Hi Hernán,

Thanks for your quick reply.

What my requirement is,
Based on the checkbox selection, I need to show/hide the timepicker of the
datetimepicker.




-----Original Message-----
From: Hernán [mailto:heamaya@gmail.com] 
Sent: Tuesday, April 24, 2012 6:10 PM
To: Struts Users Mailing List
Subject: Re: problem in hiding timepicker of struts jquery datetimepicker

As you are using struts2 jquery plugin, I would use jquery:

<script type="text/javascript">
$(
   function() {
       $("#selectId").change(
          var selectedValue = $(this).val();

          if(selectedValue == 'A') {
             $("#timePickerId").hide();
          }


       );
   }
);

</script>

Just use show() when you want to...
On Tue, Apr 24, 2012 at 9:33 AM, Reshmi <ra...@trinitymobility.com> wrote:

>  Hi all,****
>
> My codes for date time picker is****
>
> ** **
>
> <sj:datepicker timepicker=*"true"* readonly=*"true"* label=*"From Date"*
> id=*"fromdate"* name=*"fromdate"* displayFormat=*"dd-mm-yy"*
> timepickerShowSecond=*"true"*  timepickerFormat=*"hh:mm:ss"*></
> sj:datepicker>****
>
>                         <sj:datepicker timepicker=*"true"* readonly=*
> "true"* label=*"To Date"* id=*"todate"* name=*"todate"* displayFormat=*
> "dd-mm-yy"* timepickerShowSecond=*"true"* timepickerFormat=*"hh:mm:ss"*
> ></sj:datepicker>****
>
> ** **
>
> ** **
>
> I want to display timepicker only for some cases****
>
> For that I put javascript function like this.****
>
> ** **
>
> ** **
>
> ** **
>
> *if*(select1=="A")****
>
>               {****
>
>              ****
>
> ** **
>
>               ****
>
>               document.getElementById("fromdate").timepicker=false;****
>
>               document.getElementById("todate").timepicker=false;****
>
>               }****
>
>         *else* ****
>
>               {****
>
>               ****
>
>               document.getElementById("fromdate").timepicker=*true*;****
>
>               document.getElementById("todate").timepicker=*true*;****
>
>               ****
>
>               }****
>
> ** **
>
> But this is not working for for me.Any one can help me?How can I implement
> it?****
>
> ** **
>
> *Best Regards,*
>
> *Reshmi***
>
> *Software Engineer | Trinity Mobility Pvt. Ltd. |
> Bangalore|+91-8971512535| ***
>
> [image: trinity-logo_small]****
>
> ** **
>
> ** **
>



-- 
Hernán


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: problem in hiding timepicker of struts jquery datetimepicker

Posted by Hernán <he...@gmail.com>.
As you are using struts2 jquery plugin, I would use jquery:

<script type="text/javascript">
$(
   function() {
       $("#selectId").change(
          var selectedValue = $(this).val();

          if(selectedValue == 'A') {
             $("#timePickerId").hide();
          }


       );
   }
);

</script>

Just use show() when you want to...
On Tue, Apr 24, 2012 at 9:33 AM, Reshmi <ra...@trinitymobility.com> wrote:

>  Hi all,****
>
> My codes for date time picker is****
>
> ** **
>
> <sj:datepicker timepicker=*"true"* readonly=*"true"* label=*"From Date"*
> id=*"fromdate"* name=*"fromdate"* displayFormat=*"dd-mm-yy"*
> timepickerShowSecond=*"true"*  timepickerFormat=*"hh:mm:ss"*></
> sj:datepicker>****
>
>                         <sj:datepicker timepicker=*"true"* readonly=*
> "true"* label=*"To Date"* id=*"todate"* name=*"todate"* displayFormat=*
> "dd-mm-yy"* timepickerShowSecond=*"true"* timepickerFormat=*"hh:mm:ss"*
> ></sj:datepicker>****
>
> ** **
>
> ** **
>
> I want to display timepicker only for some cases****
>
> For that I put javascript function like this.****
>
> ** **
>
> ** **
>
> ** **
>
> *if*(select1=="A")****
>
>               {****
>
>              ****
>
> ** **
>
>               ****
>
>               document.getElementById("fromdate").timepicker=false;****
>
>               document.getElementById("todate").timepicker=false;****
>
>               }****
>
>         *else* ****
>
>               {****
>
>               ****
>
>               document.getElementById("fromdate").timepicker=*true*;****
>
>               document.getElementById("todate").timepicker=*true*;****
>
>               ****
>
>               }****
>
> ** **
>
> But this is not working for for me.Any one can help me?How can I implement
> it?****
>
> ** **
>
> *Best Regards,*
>
> *Reshmi***
>
> *Software Engineer | Trinity Mobility Pvt. Ltd. |
> Bangalore|+91-8971512535| ***
>
> [image: trinity-logo_small]****
>
> ** **
>
> ** **
>



-- 
Hernán