Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   List Box value >> display text1,2,3,4,5 etc. (http://www.velocityreviews.com/forums/t794004-list-box-value-display-text1-2-3-4-5-etc.html)

Fawke101 04-16-2004 12:33 PM

List Box value >> display text1,2,3,4,5 etc.
 
Hi there,

I need a page where a user selects a value from a menu/list box, and a
certain part of a form is dislpayed.
Ideally (probs the easiest way for me) is to create 1 form with all the text
boxes etc and then when a user selects a value from the initial list box the
relative boxes are dislpayed.

Any help or examples of this much appreciated.
Can you have subforms of a form? if so how could i disable/enable a sub form
upon selecting a list box value?

*********
<select name="lstType" id="lstType">
<option selected>Please select the value......</option>
<option value="val_1">value1</option>
<option value="val_2">value2</option>
<option value="val_3">value3</option>
<option value="val_4">value4</option>
</select>
*********

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com



Bob Barrows 04-16-2004 02:59 PM

Re: List Box value >> display text1,2,3,4,5 etc.
 
Fawke101 wrote:
> Hi there,
>
> I need a page where a user selects a value from a menu/list box, and a
> certain part of a form is dislpayed.
> Ideally (probs the easiest way for me) is to create 1 form with all
> the text boxes etc and then when a user selects a value from the
> initial list box the relative boxes are dislpayed.
>
> Any help or examples of this much appreciated.
> Can you have subforms of a form? if so how could i disable/enable a
> sub form upon selecting a list box value?
>
> *********
> <select name="lstType" id="lstType">
> <option selected>Please select the value......</option>
> <option value="val_1">value1</option>
> <option value="val_2">value2</option>
> <option value="val_3">value3</option>
> <option value="val_4">value4</option>
> </select>
> *********


This will require client-side DHTML code, which is off-topic for this group.
Anything that requires something to happen in response to a user's action
without submitting anything back to the server is outside the purview of
ASP. In the future, look for groups with "dhtml" in their name, or post to
one of the .scripting.* newsgroups depending on the script language you wish
to use (jscript or vbscript - most likely it will be jscript).

To solve your issue, you will need to create some divs whose display
property is initially set to "none".

<div id=div1 style="display:none">
relevant textboxes
</div>
<div id=div2 style="display:none">
relevant textboxes
</div>
etc.

Modify your SELECT tag to set the onchange event to the function you will
use to show/hide the divs:
<select name="lstType" id="lstType"
onchange="return lstType_onchange();">

Create your event handler as follows:
<SCRIPT type="text/javascript">
function lstType_onchange()
{
/*there will likely be an easier way depending on what the option values
really are (you can probably parse the div id from the value) but
for the
sake of this example, I will use a switch:*/
switch (lstType.value)
{
case "val_1":
showDiv("div1")
break
case "val_2":
showDiv("div2")
break
case "val_3":
showDiv("div3")
break
case "val_4":
showDiv("div4")
break
}
}
function showDiv(pDiv)
{
var i, oDiv
var divs=new array("div1","div2", "div3","div4")
for (var i=0;i<3;i++)
{
oDiv=document.getElementById(divs[i])
oDiv.style.diplay = "none"
if (divs[i] == pDiv) {oDiv.style.diplay = "block"}
}
}
</SCRIPT>

Please follow up with any questions in a client-side scripting group.

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



Randy Webb 04-16-2004 04:28 PM

Re: List Box value >> display text1,2,3,4,5 etc.
 
Bob Barrows wrote:
> Fawke101 wrote:
>
>>Hi there,
>>
>>I need a page where a user selects a value from a menu/list box, and a
>>certain part of a form is dislpayed.
>>Ideally (probs the easiest way for me) is to create 1 form with all
>>the text boxes etc and then when a user selects a value from the
>>initial list box the relative boxes are dislpayed.
>>
>>Any help or examples of this much appreciated.
>>Can you have subforms of a form? if so how could i disable/enable a
>>sub form upon selecting a list box value?
>>
>>*********
>><select name="lstType" id="lstType">
>><option selected>Please select the value......</option>
>><option value="val_1">value1</option>
>><option value="val_2">value2</option>
>><option value="val_3">value3</option>
>><option value="val_4">value4</option>
>></select>
>>*********

>
>
> This will require client-side DHTML code, which is off-topic for this group.


<snip>

How is it "off-topic for this group" if its posted in
microsoft.public.scripting.jscript ? Which is where I read it from..

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

Roland Hall 04-16-2004 04:57 PM

Re: List Box value >> display text1,2,3,4,5 etc.
 
"Randy Webb" wrote in message news:pfCdnSSQ9ol_lB3d4p2dnA@comcast.com...
: Bob Barrows wrote:
: > Fawke101 wrote:
: >
: >>I need a page where a user selects a value from a menu/list box, and a
: >>certain part of a form is dislpayed.
: >>Ideally (probs the easiest way for me) is to create 1 form with all
: >>the text boxes etc and then when a user selects a value from the
: >>initial list box the relative boxes are dislpayed.
: >>
: >>Any help or examples of this much appreciated.
: >>Can you have subforms of a form? if so how could i disable/enable a
: >>sub form upon selecting a list box value?
: >>
: >>*********
: >><select name="lstType" id="lstType">
: >><option selected>Please select the value......</option>
: >><option value="val_1">value1</option>
: >><option value="val_2">value2</option>
: >><option value="val_3">value3</option>
: >><option value="val_4">value4</option>
: >></select>
: >>*********
: >
: >
: > This will require client-side DHTML code, which is off-topic for this
group.
:
: <snip>
:
: How is it "off-topic for this group" if its posted in
: microsoft.public.scripting.jscript ? Which is where I read it from..

Because it is cross posted and some of us read it in
m.p.inetserver.asp.general.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp



Fawke101 04-18-2004 05:59 PM

Re: List Box value >> display text1,2,3,4,5 etc.
 
Thanks for you responses guys, a great help.
I have divided the form into a group of tables, and i would like to display
the table in respect to which list box value is selected.

Will the Divs solution still apply? what exactly are Divs?

Thanks again people

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"Roland Hall" <nobody@nowhere> wrote in message
news:u$RrYM9IEHA.3556@TK2MSFTNGP10.phx.gbl...
> "Randy Webb" wrote in message news:pfCdnSSQ9ol_lB3d4p2dnA@comcast.com...
> : Bob Barrows wrote:
> : > Fawke101 wrote:
> : >
> : >>I need a page where a user selects a value from a menu/list box, and a
> : >>certain part of a form is dislpayed.
> : >>Ideally (probs the easiest way for me) is to create 1 form with all
> : >>the text boxes etc and then when a user selects a value from the
> : >>initial list box the relative boxes are dislpayed.
> : >>
> : >>Any help or examples of this much appreciated.
> : >>Can you have subforms of a form? if so how could i disable/enable a
> : >>sub form upon selecting a list box value?
> : >>
> : >>*********
> : >><select name="lstType" id="lstType">
> : >><option selected>Please select the value......</option>
> : >><option value="val_1">value1</option>
> : >><option value="val_2">value2</option>
> : >><option value="val_3">value3</option>
> : >><option value="val_4">value4</option>
> : >></select>
> : >>*********
> : >
> : >
> : > This will require client-side DHTML code, which is off-topic for this
> group.
> :
> : <snip>
> :
> : How is it "off-topic for this group" if its posted in
> : microsoft.public.scripting.jscript ? Which is where I read it from..
>
> Because it is cross posted and some of us read it in
> m.p.inetserver.asp.general.
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation -

http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp
>
>




Bob Barrows 04-18-2004 06:06 PM

Re: List Box value >> display text1,2,3,4,5 etc.
 
Fawke101 wrote:
> Thanks for you responses guys, a great help.
> I have divided the form into a group of tables, and i would like to
> display the table in respect to which list box value is selected.
>
> Will the Divs solution still apply? what exactly are Divs?
>

Please remove the asp group from your crosspost. This has nothing to do with
asp.

(Follow-Ups set to microsoft.public.scripting.jscript)
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



Fawke101 04-18-2004 06:11 PM

Re: List Box value >> display text1,2,3,4,5 etc.
 
my apologies....... i will continue to post in the JS newsgroup

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"Fawke101" <guy@ANTIbradflack.SPAMcom> wrote in message
news:e22Ar7WJEHA.620@TK2MSFTNGP10.phx.gbl...
> Thanks for you responses guys, a great help.
> I have divided the form into a group of tables, and i would like to

display
> the table in respect to which list box value is selected.
>
> Will the Divs solution still apply? what exactly are Divs?
>
> Thanks again people
>
> --
> Thanks in advance
>
> Fawke
>
> Please remove ANTI and SPAM
> from my email address before emailing me.
>
> www.bradflack.com
> "Roland Hall" <nobody@nowhere> wrote in message
> news:u$RrYM9IEHA.3556@TK2MSFTNGP10.phx.gbl...
> > "Randy Webb" wrote in message news:pfCdnSSQ9ol_lB3d4p2dnA@comcast.com...
> > : Bob Barrows wrote:
> > : > Fawke101 wrote:
> > : >
> > : >>I need a page where a user selects a value from a menu/list box, and

a
> > : >>certain part of a form is dislpayed.
> > : >>Ideally (probs the easiest way for me) is to create 1 form with all
> > : >>the text boxes etc and then when a user selects a value from the
> > : >>initial list box the relative boxes are dislpayed.
> > : >>
> > : >>Any help or examples of this much appreciated.
> > : >>Can you have subforms of a form? if so how could i disable/enable a
> > : >>sub form upon selecting a list box value?
> > : >>
> > : >>*********
> > : >><select name="lstType" id="lstType">
> > : >><option selected>Please select the value......</option>
> > : >><option value="val_1">value1</option>
> > : >><option value="val_2">value2</option>
> > : >><option value="val_3">value3</option>
> > : >><option value="val_4">value4</option>
> > : >></select>
> > : >>*********
> > : >
> > : >
> > : > This will require client-side DHTML code, which is off-topic for

this
> > group.
> > :
> > : <snip>
> > :
> > : How is it "off-topic for this group" if its posted in
> > : microsoft.public.scripting.jscript ? Which is where I read it from..
> >
> > Because it is cross posted and some of us read it in
> > m.p.inetserver.asp.general.
> >
> > --
> > Roland Hall
> > /* This information is distributed in the hope that it will be useful,

but
> > without any warranty; without even the implied warranty of

merchantability
> > or fitness for a particular purpose. */
> > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> > WSH 5.6 Documentation -

> http://msdn.microsoft.com/downloads/list/webdev.asp
> > MSDN Library - http://msdn.microsoft.com/library/default.asp
> >
> >

>
>




Bob Barrows 04-18-2004 06:22 PM

Re: List Box value >> display text1,2,3,4,5 etc.
 
Fawke101 wrote:
> Thanks for you responses guys, a great help.
> I have divided the form into a group of tables, and i would like to
> display the table in respect to which list box value is selected.
>
> Will the Divs solution still apply? what exactly are Divs?
>
> Thanks again people
>


Same solution: only set the tables' id property and use it to set their
display properties instead of the divs'.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"




All times are GMT. The time now is 09:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.