how can I disable and enable input type?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • idsanjeev
    New Member
    • Oct 2007
    • 241

    #31
    Hi gits
    i send a new file attachment thats work fine but don't work when the hidden property is one time added in requistion other wise its work fine
    the error thats displayed in status bar that is object require in javasript where function toggle_state is diclare and compare with one .

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5388

      #32
      hi ...

      in your attached code you have:

      [CODE=asp]<input type="text" name="purpose" style="visibili ty:hidden; width:400px" maxlength="150" value=<%=porpos e%>>[/CODE]
      add an id-attribute since the toggle-function relies on it ...

      kind regards

      Comment

      • idsanjeev
        New Member
        • Oct 2007
        • 241

        #33
        Hi gits
        Thanks for your kind time to time guidance
        this code work fine

        [CODE=javascript]
        function toggle_state(ob j) {
        // here we check the value of your select-box
        //var val = obj.value == 1;

        if (obj.value == 1)
        {
        val=1;
        }
        else
        {
        val=0;
        }

        var input_node = document.getEle mentById('purpo se');

        input_node.styl e.visibility = val ? 'hidden' : 'visible';

        }
        </script>[/CODE]

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5388

          #34
          Originally posted by idsanjeev
          Hi gits
          Thanks for your kind time to time guidance
          this code work fine

          [CODE=javascript]
          function toggle_state(ob j) {
          // here we check the value of your select-box
          //var val = obj.value == 1;

          if (obj.value == 1)
          {
          val=1;
          }
          else
          {
          val=0;
          }

          var input_node = document.getEle mentById('purpo se');

          input_node.styl e.visibility = val ? 'hidden' : 'visible';

          }
          </script>[/CODE]
          your adaption is definitly equivalent to the simple one line that you have 'outcommented' ... this couldn't have made a problem ... simply produces more lines of code and worse performance since 0 and 1 has to evaled to false/true in our assignment later on ... so it has to work with the

          [CODE=javascript]var val = obj.value == 1;
          [/CODE]
          too?

          kind regards

          Comment

          Working...