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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make text boxes show when different optins chosen 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I would like to make different text boxes for fill in show if the Round Product is picked or the Square product is picked from a Drop down combo box.
here is my Starting code:
----------------------------
<script Language=&quot;VBScript&quot;><!--
Sub ProdType_onchange
Set theForm = document.FrontPage_Form1

If (theForm.ProdType.selectedindex = 1) then
msgbox &quot;Round&quot;
ElseIf (theForm.ProdType.selectedindex = 2) then
msgbox &quot;Rectangle&quot;
ElseIf (theForm.ProdType.selectedindex = 3) then
ElseIf (theForm.ProdType.selectedindex = 4) then
End if

End sub

--></script>
--------------------
Do I have to make a subroutine ????
or ????

TIA DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
To show and unshow a text box, just use this:

document.formName.elementName.style.visibility = 'hidden'

or

= 'visible'

Should be able to stick them in the same if blocks as your msgbox's --

:)
Paul Prewett
penny.gif
penny.gif
 
Sorry I'm a ditz

where do I put this and what goes in style
app_survey.asp is the anem of the WEB page
FrontPage_Form1 = the default form name
DIA = the text box name

<%app_survey.FrontPage_Form1.DIA.style.visibility = 'hidden'%>

<script Language=&quot;VBScript&quot;><!--
Sub ProdType_onchange
Set theForm = document.FrontPage_Form1

If (theForm.ProdType.selectedindex = 1) then
msgbox &quot;Round&quot;
ElseIf (theForm.ProdType.selectedindex = 2) then
msgbox &quot;Rectangle&quot;
ElseIf (theForm.ProdType.selectedindex = 3) then
ElseIf (theForm.ProdType.selectedindex = 4) then
End if

End sub

--></script>


DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Sub ProdType_onchange
Set theForm = document.FrontPage_Form1

If (document.FrontPage_Form1.ProdType.selectedindex = 1) then
msgbox &quot;Round&quot;
document.FrontPage_Form1.DIA.style.visibility = 'visible'
'make the others hidden
ElseIf (theForm.ProdType.selectedindex = 2) then
msgbox &quot;Rectangle&quot;
ElseIf (theForm.ProdType.selectedindex = 3) then
ElseIf (theForm.ProdType.selectedindex = 4) then
End if

End sub

Assuming that the textbox, DIA, is the box that you want to show when the selectedIndex = 1, and so on --

Be sure to hide the others that should be hidden when the selectedIndex = 1, and vice versa.

Does that clear it up?
paul
penny.gif
penny.gif
 
Ditz question #2

where do I the &quot;hiddens&quot; when the form opens they don't show untill called

document.FrontPage_Form1.DIA.style.visibility = 'hidden'
document.FrontPage_Form1.Height.style.visibility = 'hidden'
------------------------------
getting this error:
Syntax error

/quote/app_survey.asp, line 122

document.FrontPage_Form1.DIA.style.visibility = 'hidden'
------------------------------------------------^


DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Well it does not work !!!! It does nothing at all
What else am I doing wrong.

------------------------
<script Language=&quot;VBScript&quot;><!--

Sub ProdType_onchange

Set theForm = document.FrontPage_Form1 ' Name of form
If (theForm.ProdType.selectedindex = 1) then
msgbox &quot;Round&quot;
theForm.DIA.style.visibility = 'visible'
theForm.Height.style.visibility = 'visible'
'make the others hidden
theForm.Length.style.visibility = 'hidden'
theForm.Width.style.visibility = 'hidden'
ElseIf (theForm.ProdType.selectedindex = 2) then
msgbox &quot;Rectangle&quot;

theForm.DIA.visible = False
'make the others hidden
theForm.Length.visible = true
theForm.Width.visible = true
theForm.Height.visible = true
ElseIf (theForm.ProdType.selectedindex = 3) then
ElseIf (theForm.ProdType.selectedindex = 4) then
End if

End sub
--></script>
------------------------------

the msgbox pops up but the text boxes just stay on even when I toggle the
I also tried the ususal VBA code which does nothing either

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Ok I got it

need a double quote instead of a single quote &quot;
theForm.DIA.style.visibility = &quot;visible&quot;

document.FrontPage_Form1.DIA.style.visibility = 'visible'

a single quote is a remark in VB
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Ooooooops -- I always get my client side vbscript and javascript mixed up.

Glad you got it worked out.

:)
paul
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top