Hidden Form items with javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • patsman77
    New Member
    • Nov 2007
    • 27

    Hidden Form items with javascript

    Hello All,

    Can someone tell me if this is possible, and if so, please direct me in the right direction on a method>

    I have a form, with radio buttons.... each question has 3 possible radio selections... either yes, no , or no answer.

    What I want to do, is hide individual questions based on the day, or a time of day.


    Any help would be great,

    Thanx,
    Patsman77
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    hi ...

    it is possible :) ... please post an example-code (html or even the js) you already have ... so that we have something to work with ... and explain a short use-case for what you want to achieve with the posted code ... so that we might give you an example for this problem ...

    kind regards

    Comment

    • patsman77
      New Member
      • Nov 2007
      • 27

      #3
      here is a small chunk of the code I have so far.

      [HTML]<TR>
      <TD bgcolor="#C0C0C 0" width="300"><FO NT COLOR="#000000" ><INPUT TYPE="radio" value="<?php echo $pass[Favorite]; ?> -<?php echo $pass[Spread]; ?>" NAME="Game01" <? if($pass[Game01]== "$pass[Favorite] -$pass[Spread]"){ echo "checked"; } ?>></FONT><?php echo $pass[Favorite]; ?>
      </TD>
      <TD bgcolor="#C0C0C 0"><CENTER><?ph p echo $pass[Spread]; ?></CENTER></TD>
      <TD bgcolor="#C0C0C 0" width="300"><FO NT COLOR="#000000" ><INPUT TYPE="radio" value="<?php echo $pass[Underdog]; ?> +<?php echo $pass[Spread]; ?>" NAME="Game01" <? if($pass[Game01]== "$pass[Underdog] +$pass[Spread]"){ echo "checked"; } ?>></FONT><?php echo $pass[Underdog]; ?></TD>
      <TD VALIGN=BOTTOM bgcolor="#C0C0C 0" width="31"> <font size="1" </font>&nbsp;<?ph p echo $pass[Day]; ?></TD>
      <TD VALIGN=BOTTOM bgcolor="#C0C0C 0" width="31"> <font size="1" </font>&nbsp;<?ph p echo $pass[Time]; ?></TD>
      <TD VALIGN=BOTTOM bgcolor="#C0C0C 0" width="54"><fon t color="#FFFFFF" ><INPUT TYPE="radio" value=" " NAME="Game01" <? if($pass[Game01]==""){ echo "checked"; } ?>>None</font></TD>
      </TR>
      <TR>
      <TD bgcolor="#C0C0C 0" width="300"><FO NT COLOR="#000000" ><INPUT TYPE="radio" value="<?php echo $pass[Favorite2]; ?> -<?php echo $pass[Spread2]; ?>" NAME="Game02" <? if($pass[Game02]== "$pass[Favorite2] -$pass[Spread2]"){ echo "checked"; } ?>></FONT><?php echo $pass[Favorite2]; ?>
      </TD>
      <TD bgcolor="#C0C0C 0"><CENTER><?ph p echo $pass[Spread2]; ?></CENTER></TD>
      <TD bgcolor="#C0C0C 0" width="300"><FO NT COLOR="#000000" ><INPUT TYPE="radio" value="<?php echo $pass[Underdog2]; ?> +<?php echo $pass[Spread2]; ?>" NAME="Game02" <? if($pass[Game02]== "$pass[Underdog2] +$pass[Spread2]"){ echo "checked"; } ?>></FONT><?php echo $pass[Underdog2]; ?></TD>
      <TD VALIGN=BOTTOM bgcolor="#C0C0C 0" width="31"> <font size="1" </font>&nbsp;<?ph p echo $pass[Day2]; ?></TD>
      <TD VALIGN=BOTTOM bgcolor="#C0C0C 0" width="31"><fon t size="1" </font>&nbsp;<?ph p echo $pass[Time2]; ?></TD>
      <TD VALIGN=BOTTOM bgcolor="#C0C0C 0" width="54"><fon t color="#FFFFFF" ><INPUT TYPE="radio" value=" " NAME="Game02" <? if($pass[Game02]==""){ echo "checked"; } ?>>None</font></TD>
      </TR>[/HTML]

      basically, I want to compare the [Day] and [Time] variables to current Day and time. If it is before the current Day and Time, then the selections are accessible, other wise then that, if it is after the Day and Time, to hide the radio buttons so no choice can be made.

      Thanx in advance, If you need more code, please just let me know.

      Patsman77

      Comment

      • gaya3
        New Member
        • Aug 2007
        • 184

        #4
        Originally posted by patsman77
        Hello All,

        Can someone tell me if this is possible, and if so, please direct me in the right direction on a method>

        I have a form, with radio buttons.... each question has 3 possible radio selections... either yes, no , or no answer.

        What I want to do, is hide individual questions based on the day, or a time of day.


        Any help would be great,

        Thanx,
        Patsman77

        Hi,
        Its possible...
        what u want to do is simple...
        u have to call onLoad() function,in that u can find the day... and code ur logic..

        -Thanks
        Hamsa

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5388

          #5
          hi ...

          to retrieve the date and time you may use javascripts Date Object ... with that you may compare your dates/times and handle the 'selectablity' ... may be you could set a disabled-attribute for the checkboxes ...

          kind regards

          Comment

          Working...