Results 1 to 3 of 3

Thread: javascript and invisble textboxes!!

  1. #1

    Thread Starter
    Junior Member eeeks's Avatar
    Join Date
    Oct 2001
    Location
    CA
    Posts
    17

    javascript and invisble textboxes!!

    Hi All,

    I have an aspx page which is being validated by javascript..The peculiarity of this page is that out of 8 text boxes only 4 are visible depending on some values in database (completely handled by the aspx page)

    The whole script is run when the 'save' button is pressed. The problem arises when the validations for the textboxes which are not currently visible are run...

    I have tried my best to detect if the object exists....
    i tried to put my validations under

    if typeof document.getElementById('textbox') != 'undefined'
    {
    }

    but this doesnt work...then i tried checking its style.visibility property if set to hidden...that also doesnt seem to work.

    Any solutions??

  2. #2
    Lively Member
    Join Date
    May 2002
    Posts
    94
    try using window.controlID.value

    you might have the visible controls inside a FORM tag and the hidden ones outside of one.



    <HTML>
    <HEAD>
    <SCRIPT>
    function ShowValue() {
    alert(window.MyCtrl.value);
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT TYPE="HIDDEN" VALUE="mud" ID="MyCtrl">
    <INPUT TYPE="button" OnClick="ShowValue()" VALUE="Click Me">
    </BODY>
    </HTML>

  3. #3

    Thread Starter
    Junior Member eeeks's Avatar
    Join Date
    Oct 2001
    Location
    CA
    Posts
    17
    got it working,....logic was right...t'was a stupid syntax problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width