OK, I've got a fairly minimal failing case:
#!/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;
}
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.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.