Click to See Complete Forum and Search --> : Dynamically generated form fields don't get submitted


bunner bob
01-01-2003, 05:58 PM
I'm trying to customize a form depending on which radio button is clicked. When the user clicks on a radio button, a function writes HTML for a form field into a <span> tag inside the form. But when I submit the form, the dynamically-generated form fields don't get submitted.

Here's the skeleton version:

<form name="myform">
<input type="radio" name="radio" onclick="makeDynamic()">
<span ID="dynamic"></span>
<input type="text" name="regularformfield">
<input type="submit">
</form>

<script (etc)>
function makeDynamic() {
document.getElementById("dynamic").innerHTML = "<input type=\"text\" name=\"dynamicformfield\">";
}
</script>

Is there some trick to making these work. My workaround is to have these dynamic fields write their values to predefined hidden fields in the form onblur (or onchange, onclick, etc.) but this seems clunky.

bunner bob
01-01-2003, 07:54 PM
Is the result of whatever I type into your dynamic field supposed to be passed along/shown in the alert?

When I fill out the two static fields and the dynamic field and submit, all I get (in the alert and as results on the next page) are what I type into the two static fields. What I type into the dynamic field doesn't show up in any of the following stuff.

bunner bob
01-01-2003, 10:12 PM
IE 5.2 on Mac OS X - that's probably it.

Guess I'll stick to my workaround - I'm starting to get kinda comfy with it anyway ')