I'm doing some volunteer work for an organization and the stuff they want might be putting me a little out of my depth. I am sure there are better ways to do this, but what I am trying to do is:
select an option from a drop down list, create a number of new form entries based on that select option, then limit some of the options in the new form elements based on a number from a database - the number in the database is based on the first select.
Currently - I am trying to do it like this:
use onChange to call a javscript function, then use document.submit() to submit the form, so that I can get the POST variable and use it to get my field from the database.
The problem is - the way I am currently doing this works - but only for a second - then the page resets and all the dynamic form elements disappear. Is there any way to stop that from happening?
I'd appreciate any advice - I've been searching for an answer and I am getting a sneaking suspicion that that the real way to do this might be to use AJAX, but I am really hoping to avoid it, since I have never used it in the past.
<form method ="POST" name = "chooseCourse" action = "">
<select name = "course" onChange = "addOptions();">
<!-- addOptions adds the radio box options to each course selection, function in file jsOptions.js -->
<option value=""> </option>
<option value="GRR">Girl's Rock n Roll Retreat - $395</option>
<option value="WJS">Women's Jam Shop - $295</option>
<option value="WGC">Women's Guitar - $150</option>
<option value="GGC">Girl's Guitar - $150</option>
<form method = "POST" name = "test" action = "Step2.php">
//divs for dynamic form elements
<div id = "rbox"></div>
<div id = "rbox2" style="display:inline"></div>
<div style="display:inline" id = "qh"></div>
<div id = "rbox3" style="display:inline"></div>
<div id = "rh" style="display:inline"></div>
var user_input = document.chooseCourse.course.value;
if (counter > 0)
if (user_input == "GRR")
if (user_input == "WGC")
//several more options
document.getElementById("rbox").innerHTML=("Please choose your level of experience:");
var qlh = document.getElementById("qh");
var sButton = document.getElementById("sbt");
var levels = document.createElement('select');
levels.options = new Option("Beginner", "Beginner");
levels.options = new Option("Intermediate - 21+ only", "Intermediate");
var submitting = document.createElement('input');