dynamic multiple selects

D

d.schulz81

Holas,

I want to do the following:
If one entry in multiple select "domain" is selected, i want to change
the content in dropdown "typ" dynamically according to the selected
domain.

If more than one entries in domain are selected, i want the dropdown
typ to disappear

here the javaScriptCode that causes an "typ has no properties" -Error:


<script language="Javascript">
<!-- Start
function updateType()
{
domain = document.forms["frm"].elements["txtDomain"];
typ = document.forms["frm"].elements["txtType"];

typ.options.length = 0; // DropDown Menü entleeren

if (domain.options
[domain.selectedIndex].
value == "Email")
{
typ.options[0] = new Option("Software");
typ.options[1] = new Option("Anbieter");
}
else if (domain.options
[domain.selectedIndex].
value == "Internet")
{
typ.options[0] = new Option("Internetzugang");
typ.options[1] = new Option("Webseiten erstellen");
}
}
// Ende -->
</script>



here the multi selects:

<tr class="color1">
<td>Domain: (Mehrfachauswahl mit <br/>gedrückter Strg-Taste
möglich)</TD>
<td colspan="2">
<SELECT size=3 name="txtDomain[]" multiple="multiple"
onchange="updateType()">
<OPTION value=0 selected> alle </OPTION>
<?
while ($arrDomain = mysql_fetch_array($rsDomain))
{
echo("<OPTION value=".$arrDomain["ID"]."> ".$arrDomain["Name"]."
</OPTION>");
}
?>
</SELECT>
</TD>
</TR>



<tr class="color1">
<td>Type: (Mehrfachauswahl mit <br/>gedrückter Strg-Taste
möglich)</TD>
<td colspan="2">
<SELECT size=3 name="txtType[]" multiple="multiple">
<OPTION value=0 selected> alle </OPTION>
</SELECT>
</TD>
</TR>

I would appreciate any help..
thank you very much

Dennis
 
M

Mick White

Holas,

I want to do the following:
If one entry in multiple select "domain" is selected, i want to change
the content in dropdown "typ" dynamically according to the selected
domain.

If more than one entries in domain are selected, i want the dropdown
typ to disappear

here the javaScriptCode that causes an "typ has no properties" -Error:


<script language="Javascript">
<!-- Start
function updateType()
{
domain = document.forms["frm"].elements["txtDomain"];

domain = document.forms["frm"].elements["txtDomain[]"];

typ = document.forms["frm"].elements["txtType"];

typ = document.forms["frm"].elements["txtType[]"];

No?

Mick[snip]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top