Greetings all,
Here is an example of what we do when we need contingent dropdowns.
<script language="JavaScript" type="text/javascript"> var comm_list = new Array(); comm_list[0] = new Array("first", 34, 37); comm_list[1] = new Array("second", 35, 37); comm_list[2] = new Array("third", 36, 37); comm_list[3] = new Array("primary", 42, 38); comm_list[4] = new Array("secondary", 43, 38); </script> <script language="JavaScript" type="text/javascript"> function change_dd(parent, target, list){ var f = parent.form; var value = parent.options[parent.options.selectedIndex].value +; f.elements[target].options.length = 0; if(value == "0"){ var newopt = new Option('--- Select an Option ---', '0'); f.elements[target].options[f.element[target].options.lengt +h] = newopt; }else{ for(var i = 0; i < list.length; i++){ if(list[i][2] == value){ var newopt = new Option(list[i][0], list[i][1]); f.elements[target].options[f.elements[target].opti +ons.length] = newopt; } } } } </script>
And here is the call from your the controlling dropdown in this case it would be your categories.
<select name="selection" onChange="change_dd(this, 'other_dd', comm_li +st)"> <option value="0">--- Select a Type ---</option> <option value="38">positional</option> <option value="37">numeric</option> </select> <select name="other_dd"> </select>
A little explaination is in order eh?
the "selection" dropdown calls the function change_dd and sends it itself, the other dropdown to populate as well as which list to use to do the population of the dropdown. So you will need the other dropdown set up for the population to take place.
The list "comm_list" is created based on the selections available in the "selection" dropdown and contain in this order: the text to display, the value to pass, the parent id for the association.
Let me know if you have any questions.

-InjunJoel

"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo

In reply to Re: HTML/Perl form question by injunjoel
in thread HTML/Perl form question by b310

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.