in reply to Submitting forms with CGI::Ajax-created fields

I couldn't run your code (seeing as you didn't post it all) so I wrote my own version for testing. I can't reproduce your results using FF2.

<form name=test action=test.cgi method=get> <select name=ordertype id=ordertype onchange=" document.getElementById('orderparams').innerHTML = ( '<input type=text name=duration>' ); "> <option value=halt>Halt <option value=attack>Attack <option value=capture>Capture <option value=move>Move <option value=rest>Rest <option value=wait>Wait </select> <div id=orderparams></div> <div><input type=submit value='Issue Order'></div> </form>

After changing the value of the SELECT, putting a foo in the text box that appears and pressing the submit button, FF requested the URI

.../test.cgi?ordertype=move&duration=foo

Does the above work for you too?

Note, the HTML was a local file (file:// scheme). That might make a difference.

Replies are listed 'Best First'.
Re^2: Submitting forms with CGI::Ajax-created fields
by dsheroh (Monsignor) on Jul 22, 2007 at 06:18 UTC
    OK, I've got a fairly minimal failing case: Using your HTML snippet in $initial_page worked properly, even with your OnChange handler changed to the CGI::Ajax call, so I added HTML::Template back in, stripped down the actual template and tried again. That lost the duration parameter just like the real version does, but using the HTML::Template-generated page body seems to behave identically, so I've put that in and removed HTML::Template. (I did save the stripped-down template and the data I fed it, just in case, but it seems unlikely to be relevant.)
Re^2: Submitting forms with CGI::Ajax-created fields
by dsheroh (Monsignor) on Jul 22, 2007 at 05:22 UTC
    Yep, I do get the same results as you from that snippet, both accessing it as a file:// and on http://localhost. So this at least confirms that it's possible to do. Now to just figure out why CGI::Ajax isn't doing it...

    Time to strip things down to a minimal failing case, I suppose.