|
-
Nov 5th, 2004, 04:31 PM
#1
Thread Starter
Frenzied Member
Javascript error
I have a form where I check a ranking of an item, if the items rank is greater than 0, then I want to display a hidden table cell. Here is how I am doing it, but it isn't working.
Can anyone tell me what the problem is???
VB Code:
'The function to show or hide the cell in the table
function CheckRanking(RankValue, elementTag)
{
if(RankValue >= 1)
{
document.forms[0].getElementById(elementTag).style.visibility ='visible';
}
else
{
document.forms[0].getElementById(elementTag).style.display = 'none';
}
}
'This is the row where the item is ranked
<td class="ESP_Data_Border" ><input maxlength="3" size="4" name="txtPriority" value="0" OnBlur="CheckRanking(this.value, 'ENHANCEMENTVERSION_B4370631-06B8-4DE4-864A-021ACDAD3087');"></td>
'This is the cell that should show or hide based on the rank entered into the cell above
<td id="ENHANCEMENTVERSION_B437063106B84DE4864A021ACDAD3087" class="ESP_Data_Border" STYLE="visibility: hidden"><select name="lstVersions"><option>HERE ARE THE VERSIONS</option></select></td>
but I keep getting a "object doesn't support this property or method" error.
Last edited by Memnoch1207; Nov 8th, 2004 at 12:56 PM.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Nov 5th, 2004, 05:38 PM
#2
getElementById only exists on the document object itself.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 8th, 2004, 08:59 AM
#3
Thread Starter
Frenzied Member
okay, I took out the forms[0] and now I get "Object Required" error.
VB Code:
function CheckRanking(RankValue, elementTag)
{
if(RankValue >= 1)
{
document.getElementById(elementTag).style.visibility ='visible';
}
else
{
document.getElementById(elementTag).style.display = 'none';
}
}
'This is the row where the item is ranked
<td class="ESP_Data_Border" ><input maxlength="3" size="4" name="txtPriority" value="0" onBlur="CheckRanking(this.value, 'ENHANCEMENTVERSION_B4370631-06B8-4DE4-864A-021ACDAD3087');"></td>
'This is the cell that should show or hide based on the rank entered into the cell above
<td id="ENHANCEMENTVERSION_B437063106B84DE4864A021ACDAD3087" class="ESP_Data_Border" STYLE="visibility: hidden"><select name="lstVersions"><option>HERE ARE THE VERSIONS</option></select></td>
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Nov 8th, 2004, 09:04 AM
#4
I don't know why. But are you aware that your show and hide lines don't counteract each other?
Also, what browsers are you testing in?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 8th, 2004, 09:05 AM
#5
Frenzied Member
you are making the argument a string right? not an object itself.
Have I helped you? Please Rate my posts. 
-
Nov 8th, 2004, 10:19 AM
#6
Thread Starter
Frenzied Member
Here's what I have.
VB Code:
function CheckRanking(RankValue, elementTag)
{
if(RankValue >= 1)
{
document.getElementById(elementTag).style.display ='';
}
else
{
document.getElementById(elementTag).style.display = 'none';
}
}
[color=red]This column determines if the next column should be shown or hidden[/color]
<td class="ESP_Data_Border" ><input maxlength="3" size="4" name="txtPriority" value="0" OnBlur="CheckRanking(this.value, 'ENHANCEMENTVERSION_E9AAD463-70D2-4EAE-A3C6-E296F6AC9E94');"></td>
[color=red]Column to be shown/hidden[/color]
<td id="ENHANCEMENTVERSION_E9AAD46370D24EAEA3C6E296F6AC9E94" class="ESP_Data_Border" STYLE="visibility: hidden"><input type="hidden" name="varVersionEnhancementID" value="{E9AAD463-70D2-4EAE-A3C6-E296F6AC9E94}"><select name="lstVersions"><option>HERE ARE THE VERSIONS</option></select></td>
If the value of the text box is greater than or equal to 1, then I want the second column to be displayed, so the user can select the correct option from the dropdown.
When I do an alert on either of the variables passed, they work fine. But I get an "Object Required" error when the code runs.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Nov 8th, 2004, 10:57 AM
#7
What does
alert(document.getElementById(elementTag));
output?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 8th, 2004, 11:42 AM
#8
Frenzied Member
Shouldn't ENHANCEMENTVERSION_E9AAD463-70D2-4EAE-A3C6-E296F6AC9E94 equal the id of the next element?
Have I helped you? Please Rate my posts. 
-
Nov 8th, 2004, 12:56 PM
#9
Thread Starter
Frenzied Member
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
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
|