Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am programming a page that is in 1

Status
Not open for further replies.

Deltaflyer

Programmer
Oct 11, 2000
184
GB
I am programming a page that is in essence a report-writer. There are apr. 15 checkboxes that the user can select for the search and add values to each of these. What i would like to do is hide all the relevant fields until the user checks the relevant button.

I.e. check the Reference box and the reference value fields appear.

the format of the page is

[*] Reference = [ ] or [ ] or [ ] or [ ].

where [*] is the checkbox.

I am using this,
document.sqlbuild1.idop1.style.visibility='hidden'
document.sqlbuild1.idval1.style.visibility='hidden'
document.sqlbuild1.idop2.style.visibility='hidden'
document.sqlbuild1.idval2.style.visibility='hidden'
document.sqlbuild1.idop3.style.visibility='hidden'
document.sqlbuild1.idval3.style.visibility='hidden'

in order to hide the fields, but i am having problems when trying to hide cell values "=" and "or" 's.

The cells are set as <td nowrap id=reffield1> = </td>

but when i try to reference this using document.sqlbuild1['reffield1'].style.visibility='hidden' i get an error stating that
'document.sqlbuild1.reffield1.style' is not an object.

If you have any ideas as to how i can get around this problem, please let me know!!!
DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
are you using ie or the other browser ?? what you wrote should be working in ie, except maybe if you have more than 1 td whose id is &quot;reffield1&quot;
let me know !
 
Yo iza,
am hoping to use both, but at the moment i am using IE.

i have removed all cell tags apart from reffield1.

Do you want the entire coding??? DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
till I see the rest of it, I can't be sure, but try just placing each group in a div and hiding and showing that one div instead of each element jared@aauser.com
 

<%@ LANGUAGE=&quot;VBScript&quot; %>
<%Response.Expires=0%>
<!-- #include file=&quot;Db.asp&quot; -->
<html>
<head>
<link REL=&quot;STYLESHEET&quot; HREF=&quot;/style.css&quot; TYPE=&quot;text/css&quot;></link>
<title>Query Builder Page</title>
<script language=&quot;JavaScript&quot;>
function parref1()
{
if (document.sqlbuild1.id.checked == true)
{
document.sqlbuild1.idop1.style.visibility='visible'
document.sqlbuild1.idval1.style.visibility='visible'
document.sqlbuild1.idop2.style.visibility='visible'
document.sqlbuild1.idval2.style.visibility='visible'
document.sqlbuild1.idop3.style.visibility='visible'
document.sqlbuild1.idval3.style.visibility='visible'
document.sqlbuild1.reffield1.visibility='visible'
}
else
{
document.sqlbuild1.idop1.style.visibility='hidden'
document.sqlbuild1.idval1.style.visibility='hidden'
document.sqlbuild1.idop2.style.visibility='hidden'
document.sqlbuild1.idval2.style.visibility='hidden'
document.sqlbuild1.idop3.style.visibility='hidden'
document.sqlbuild1.idval3.style.visibility='hidden'
document.sqlbuild1.reffield1.visibility='hidden'
}
}
</script>
</head>
<body bgcolor=&quot;#1f59ad&quot;>
<%
Response.Write &quot;<table cellspacing=0 cellpadding=0 align=center border=1>&quot;
Response.Write &quot;<tr><th colspan=200 align=center><font size=5 color=white><u>Query Builder</u></font></th></tr>&quot;

Response.Write &quot;<tr><th colspan=200 align=center>Details</th></tr>&quot;

Response.Write &quot;<tr><th width=150>Select Field To Search</th>&quot;
Response.Write &quot;<th width=50>Operator</th><th width=100>Enter Value</th><th width=10>OR</th>&quot;
Response.Write &quot;<th width=50>Operator</th><th width=100>Enter Value</th><th width=10>OR</th>&quot;
Response.Write &quot;<th width=50>Operator</th><th width=100>Enter Value</th></tr>&quot;

Response.Write &quot;<form name=sqlbuild1 action=user_generic1.asp method=post>&quot;

'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Response.Write &quot;<tr><td nowrap><input type=checkbox name=id value='y' onclick=parref1()>Par Ref</td>&quot;

Response.Write &quot;<td nowrap align=center>&quot;
Response.Write &quot;<select name=idop1>&quot;
Response.Write &quot;<option value=1>=</option>&quot;
Response.Write &quot;<option value=2>Like</option>&quot;
Response.Write &quot;</select></td><td nowrap align=left><input type=text name=idval1 size=13>&quot;
Response.Write &quot;<td nowrap id=reffield1> OR </td>&quot;

Response.Write &quot;<td nowrap align=center>&quot;
Response.Write &quot;<select name=idop2>&quot;
Response.Write &quot;<option value=1>=</option>&quot;
Response.Write &quot;<option value=2>Like</option>&quot;
Response.Write &quot;</select></td><td nowrap align=left><input type=text name=idval2 size=13>&quot;
Response.Write &quot;<td nowrap> OR </td>&quot;

Response.Write &quot;<td nowrap align=center>&quot;
Response.Write &quot;<select name=idop3>&quot;
Response.Write &quot;<option value=1>=</option>&quot;
Response.Write &quot;<option value=2>Like</option>&quot;
Response.Write &quot;</select></td><td nowrap align=left><input type=text name=idval3 size=13></td></tr>&quot;

'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Response.Write &quot;</form></table>&quot;

%>
<script language=&quot;JavaScript&quot;>
document.sqlbuild1.idop1.style.visibility='hidden'
document.sqlbuild1.idval1.style.visibility='hidden'
document.sqlbuild1.idop2.style.visibility='hidden'
document.sqlbuild1.idval2.style.visibility='hidden'
document.sqlbuild1.idop3.style.visibility='hidden'
document.sqlbuild1.idval3.style.visibility='hidden'
document.sqlbuild1.reffield1.visibility='hidden'
</script>
</body>
</html>


Hope this helps. DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
reffield1 is the only one not to work ??? if so, then i suppose it's because ie doesn't really like id for the td - what you could do is either try on the tr or as jared said, use a div (or a span !)
but i would use the div (or span) INSIDE the td - i'm not sure if it is working but i guess so
<td><span id=reffield1>blahblah</span></td>
 
i changed the resulting document to look like this and it worked:

function parref1()
{
if (document.sqlbuild1.id.checked == true)
{
document.sqlbuild1.idop1.style.visibility='visible'
document.sqlbuild1.idval1.style.visibility='visible'
document.sqlbuild1.idop2.style.visibility='visible'
document.sqlbuild1.idval2.style.visibility='visible'
document.sqlbuild1.idop3.style.visibility='visible'
document.sqlbuild1.idval3.style.visibility='visible'
//document.sqlbuild1.reffield1.visibility='visible'
reffield1.style.visibility='visible'
}
else
{
document.sqlbuild1.idop1.style.visibility='hidden'
document.sqlbuild1.idval1.style.visibility='hidden'
document.sqlbuild1.idop2.style.visibility='hidden'
document.sqlbuild1.idval2.style.visibility='hidden'
document.sqlbuild1.idop3.style.visibility='hidden'
document.sqlbuild1.idval3.style.visibility='hidden'
//document.sqlbuild1.
reffield1.style.visibility='hidden'
}
}

function init()
{
document.sqlbuild1.idop1.style.visibility='hidden'
document.sqlbuild1.idval1.style.visibility='hidden'
document.sqlbuild1.idop2.style.visibility='hidden'
document.sqlbuild1.idval2.style.visibility='hidden'
document.sqlbuild1.idop3.style.visibility='hidden'
document.sqlbuild1.idval3.style.visibility='hidden'
//document.sqlbuild1.reffield1.visibility='hidden'
reffield1.style.visibility='hidden'
}

i think you are trying to reference the td throught he form...jsut use its id and attach style before visibility jared@aauser.com
 
Jared, You de man!!!B-)

That works perfectly, cheers mate!!:-D DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
Jared, update to my last post :

The coding you gave me,
reffield1.style.visibility = 'hidden'
is okay, but it is hiding the bordering on the cell as well.

It is not imperative, but how could i get around this in the future??
DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
jared you are great ! i read too fast and didn't see the form trick ;-)
deltaflyer, it's normal it's hiding the borders as well, because basically it hides the whole <td> ...</td> including <td> - what you can do is try to use the span (or div) trick above, or wait for jared to come back, as i'm reading tooooo fast those days ! %-)
 
iza's right, use a span or a div to hide the actual content jared@aauser.com
 
Deltaflyer(programmer)
I am Djordje and I'm can't figure out my two problems for microsoft visual c++ homework. Question 1 problem15.5.4, we desire to insert a new structure into the linked list of structures created by Program 15.11. The function developed to do this in Excercise 3 assumed that the address of proceding structure is known. Write a function called
findRecord() that returns the address of the structure immediately preceding the point at which the new structure is to be inserted.(Hint: findRecord() must request the new name as input and compare the entered name to existing names to determine where to place the new name.)
Question 2 11.1.7, a. Create a base class named Rectangle that contains lenth and width data members. From this class dertive a class named Box having an additional
data member named depth. The function members of the base Rectangle class should have a constructor and an area(), which returns the surface area of the box, and a volume() function. b. Include the classes constructed for Exc 7a in a working C++ program. Have your program call all of the member functions in each class and explain the result when the distance() function is called using a Box object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top