in reply to Re: Submitting forms with CGI::Ajax-created fields
in thread Submitting forms with CGI::Ajax-created fields
#!/usr/bin/perl -wT use strict; use CGI qw(:standard); use CGI::Carp qw (fatalsToBrowser); #use HTML::Template; my $initial_page = <<'EOHTML'; <html><head></head><body> <table width=100% border=0> <tr><th>Orders</th> <td colspan=4> Some order<br> </td></tr> <tr><form name=myform action=test.cgi method=get> <td></td> <td colspan=3> <input type=hidden name=action value=issueorder> <input type=hidden name=id id=unitid value=12345> <select name=ordertype id=ordertype size=1 style="width:100%" OnMouseUp="order_params(['ordertype', 'unitid'], ['orderpara +ms']);"> <option value=halt> Halt <option value=wait> Wait </select> <div id=orderparams></div> </td> <td style="vertical-align:bottom"><input type=submit value='Issue +Order'> </td> </form></tr> </table> </body> EOHTML require CGI::Ajax; my $cgi = new CGI(); my $pjx = new CGI::Ajax(order_params => \&order_params); print $pjx->build_html($cgi, $initial_page); exit 0; sub order_params { my $retval = <<'EOHTML2'; <table width=100% border=0> <tr> <th width=10%>Duration</th> <td><input type=text name=duration style="width:100%"></td> </tr> </table> EOHTML2 return $retval; }
|
|---|