Hello friends,
My program for filing and manipulating commands interfaced to a database persists with a curious, but disrupting bug. I was able to confine the problem to a small, simple script that includes a (submit) button to activate
the program. The default value of a textarea is then assign to a
variable ( param('textarea name')) which is in turn printed below on the web page.
Results?: Starting with a cleared textarea, a first click of the button brings the default command to the textarea. A second click of the button replaces the last two characters of the previous command with"Pr".
For example: SELECT * FROM Departments
becomes........SELECT * FROM DepartmenPr
From where does this "Pr" bug originate and how is it entering the textarea?
This portion of my program is below:
----------------------------------
#!/usr/bin/perl -w
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use strict;
my $query = new CGI;
my $JSCRIPT=<<EOF;
function sub_dispatcher() {
document.sql_tool.submit();//document.sql_tool.mysql_Query = passit;
}
EOF
;
#SETTING UP A FORM FOR INPUT:
print $query->header();
print $query->start_html(-title => 'Selection ',
-BGCOLOR=>'lavender',
-script=>$JSCRIPT);
print $query->startform(-name=>'sql_tool');
print $query->textarea(-name=>'mysql_Query',
-default=>'SELECT * FROM Departments',
-id=>'textarea1',
-rows=>14,
-cols=>70),p;
# -size=>90),p;
print $query->button(-name=>'save2file',
-value=>'execute write-in (above)',
-onClick=>"sub_dispatcher()"),p;
print $query->endform(),
hr;
#------------------------------------------------------
#VARIABLES:
my $query_nw = $query->param('mysql_Query');
print "from textarea: $query_nw",p;
Thank you.
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.