CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 ListBox Problem

Print topic Send  topic

Author Message
Sebastian Pfohl
Posted: 02/04/2001, 5:25 AM

I have a little problem here with my tables and i hope anyone can help me:
i have to subdivide a artikel table in groups and categories

there are 4 groups, in every group i have different categories and now i
would select automaticly the categorys by groups with select fields...

group1: category1; category2; category3
group2: category4;
group3: category5;
group4: category6; category7; category8; category9...... and so on


now i have two select fields in my codecharge (ListBox)

group: |---------------|>
category: |---------------|>

the following is my wish: when i select in the first box (group) the group1,
only the possible categorys for group1 should appear in my category box.


I have no idea what i should do, to make such a thing. and i hope anyone can
help , to point me to right direction

guest
Posted: 02/05/2001, 4:37 AM

Hello Sebastian ,
You can do this in 2 ways :
1) On client side with Javascript
2) On server side with your scripting language


Personally , I'd prefer the 1st one.
1) You can dynamically assign valus to the listbox with categories.
when the age is show fist you normally show 1 listbox with 1st group
and the 2nd listbox with it's categories , when user changes the 1st listbox
, you trap this with OnChange Javascript event , and assign to the second
listbox another categories , relevant to a newly chosen group . see HTML
example below


===========================================================================

<body>


<script language="javascript">

function ChangeCats()
{
switch (document.forms[0].elements[0].selectedIndex) {
case 0 : document.forms[0].elements[1].options[0].text="Internet";
document.forms[0].elements[1].options[1].text="Hardware news";break;
case 1: document.forms[0].elements[1].options[0].text="Movies";
document.forms[0].elements[1].options[1].text="Hobbies";break;
}


}


</script>

<form name="form">
<select name="groups" onChange="ChangeCats()">
<option>Computers</option>
<option>Entertainment</option>
</select>


<select name="cats">
<option>Internet</option>
<option>Hardware news</option>
</select>
</form>

</body>

===========================================================================
2) If you want to do in on server side you must hook OnChange event on your
select and this event must
reload page(submit form) with new paramaters which will tell you what
categories to choose.




Sebastian Pfohl <sebastian.pfohl@gmx.de> wrote in message
news:95jl7r$k3o$1@news.codecharge.com...
> I have a little problem here with my tables and i hope anyone can help me:
> i have to subdivide a artikel table in groups and categories
>
> there are 4 groups, in every group i have different categories and now i
> would select automaticly the categorys by groups with select fields...
>
> group1: category1; category2; category3
> group2: category4;
> group3: category5;
> group4: category6; category7; category8; category9...... and so on
>
>
> now i have two select fields in my codecharge (ListBox)
>
> group: |---------------|>
> category: |---------------|>
>
> the following is my wish: when i select in the first box (group) the
group1,
> only the possible categorys for group1 should appear in my category box.
>
>
> I have no idea what i should do, to make such a thing. and i hope anyone
can
> help , to point me to right direction
>
>

Michael Davidson
Posted: 12/26/2002, 8:54 AM

I am trying to do something similar ... This is great info but what if the
category and subcategory exists in two tables because the subcategories
change often?

Michael

"Alexey Alexapolsky" <alexa@codecharge.com> wrote in message
news:95m6pg$ue2$1@news.codecharge.com...
> Hello Sebastian ,
> You can do this in 2 ways :
> 1) On client side with Javascript
> 2) On server side with your scripting language
>
>
> Personally , I'd prefer the 1st one.
> 1) You can dynamically assign valus to the listbox with categories.
> when the age is show fist you normally show 1 listbox with 1st group
> and the 2nd listbox with it's categories , when user changes the 1st
listbox
> , you trap this with OnChange Javascript event , and assign to the second
> listbox another categories , relevant to a newly chosen group . see HTML
> example below
>
>
>
===========================================================================
>
> <body>
>
>
> <script language="javascript">
>
> function ChangeCats()
> {
> switch (document.forms[0].elements[0].selectedIndex) {
> case 0 : document.forms[0].elements[1].options[0].text="Internet";
> document.forms[0].elements[1].options[1].text="Hardware news";break;
> case 1: document.forms[0].elements[1].options[0].text="Movies";
> document.forms[0].elements[1].options[1].text="Hobbies";break;
> }
>
>
> }
>
>
> </script>
>
> <form name="form">
> <select name="groups" onChange="ChangeCats()">
> <option>Computers</option>
> <option>Entertainment</option>
> </select>
>
>
> <select name="cats">
> <option>Internet</option>
> <option>Hardware news</option>
> </select>
> </form>
>
> </body>
>
>
===========================================================================
> 2) If you want to do in on server side you must hook OnChange event on
your
> select and this event must
> reload page(submit form) with new paramaters which will tell you what
> categories to choose.
>
>
>
>
> Sebastian Pfohl <sebastian.pfohl@gmx.de> wrote in message
>news:95jl7r$k3o$1@news.codecharge.com...
> > I have a little problem here with my tables and i hope anyone can help
me:
> > i have to subdivide a artikel table in groups and categories
> >
> > there are 4 groups, in every group i have different categories and now i
> > would select automaticly the categorys by groups with select fields...
> >
> > group1: category1; category2; category3
> > group2: category4;
> > group3: category5;
> > group4: category6; category7; category8; category9...... and so on
> >
> >
> > now i have two select fields in my codecharge (ListBox)
> >
> > group: |---------------|>
> > category: |---------------|>
> >
> > the following is my wish: when i select in the first box (group) the
> group1,
> > only the possible categorys for group1 should appear in my category box.
> >
> >
> > I have no idea what i should do, to make such a thing. and i hope anyone
> can
> > help , to point me to right direction
> >
> >
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.