|
-
Jun 27th, 2003, 07:34 AM
#1
Thread Starter
Junior Member
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??
-
Jun 27th, 2003, 08:45 AM
#2
Lively Member
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>
-
Jul 1st, 2003, 01:18 AM
#3
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|