dsheroh has asked for the wisdom of the Perl Monks concerning the following question:
However, when I submit the form, only the values of the static fields are sent back. The controls which were added dynamically via CGI::Ajax seem to be ignored. Further details:
Selecting, say, a "Wait" order causes CGI::Ajax to send back the text<tr><form name=orderform action=crystomere.cgi method=get> <td></td> <td colspan=3> <input type=hidden name=action value=issueorder> <input type=hidden name=id id=unitid value=1891233> <select name=ordertype id=ordertype size=1 style="width:100%" On +MouseUp="order_params(['ordertype', 'unitid'], ['orderparams']);"> <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> </td> <td style="vertical-align:bottom"><input type=submit value='Issue +Order'></td> </form></tr>
(which is inserted into the "orderparams" div) but a "submit" then GETs crystomere.cgi?action=issueorder&id=1891233&ordertype=wait - action, id, and ordertype are there, but duration is nowhere to be found.<table width=100% border=0> <tr><th width=10%>Duration</th><td><input type=text name=duration styl +e="width:100%"></td></tr> </table>
The Firefox DOM inspector shows that the new field is present, it is within the form tags, and it is named as expected. On the advice of a Java junkie friend, I tried changing the submit control to a plain button which did a JavaScript alert showing the value of the CGI::Ajax-added control, then using JS to perform the actual submit; the alert displayed the correct value, but the value was still not sent back to the server.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Submitting forms with CGI::Ajax-created fields
by ikegami (Patriarch) on Jul 22, 2007 at 05:07 UTC | |
by dsheroh (Monsignor) on Jul 22, 2007 at 06:18 UTC | |
by dsheroh (Monsignor) on Jul 22, 2007 at 05:22 UTC | |
|
Re: Submitting forms with CGI::Ajax-created fields
by Cody Pendant (Prior) on Jul 22, 2007 at 21:39 UTC | |
by dsheroh (Monsignor) on Jul 22, 2007 at 22:21 UTC | |
by ikegami (Patriarch) on Jul 23, 2007 at 18:57 UTC |