Hi.
I am trying to create a CGI script that will use Perl to read a text file to
get a list of values, then turn that list into a menu on a website. The menu
will be a form with a JavaScript "submit" function. . When someone selects a
menu-item, the form will submit the value of that list-entry to another CGI
page.
The problem I'm encountering is that the script I've written submits every
value of the form rather than the one specific menu item's value. This means
that, on the receiving CGI page, I'm unable to tell which one value has been
selected because I've received them all.
As near as I can tell, the flaw in my scripting is in the JS line (but just
in case I'm wrong, I've CC'd this to PERL.MISC).
I am very new to JS and am having a very difficult time comprehending it.
Before I display the code I've written, I'd like to also ask for
recommendations for good beginner-guide-books for JS. Is O'Reilly's "Rhino"
book a good starting place?
Regards and thanks.
Here's the relevant code:
print "<FORM ACTION='/cgi-bin/sub_cat_view.cg i' NAME='myform' METHOD=
'get' target='splash' >";
open (CATDAT, "<categories.da t");
while (<CATDAT>){
@categories = split /#/, "$_";
$cat_length = @categories;
$loop=0;
print "<H4>";
while ($loop < $cat_length){
print "<A
HREF='javascrip t:document.myfo rm.submit()'>$c ategories
[$loop]</A><BR>";
print "<INPUT TYPE='hidden' NAME='$categori es[$loop]'
VALUE='cat
egory'>";
$loop++;
}
}
close (CATDAT);
print "</FORM>";
I am trying to create a CGI script that will use Perl to read a text file to
get a list of values, then turn that list into a menu on a website. The menu
will be a form with a JavaScript "submit" function. . When someone selects a
menu-item, the form will submit the value of that list-entry to another CGI
page.
The problem I'm encountering is that the script I've written submits every
value of the form rather than the one specific menu item's value. This means
that, on the receiving CGI page, I'm unable to tell which one value has been
selected because I've received them all.
As near as I can tell, the flaw in my scripting is in the JS line (but just
in case I'm wrong, I've CC'd this to PERL.MISC).
I am very new to JS and am having a very difficult time comprehending it.
Before I display the code I've written, I'd like to also ask for
recommendations for good beginner-guide-books for JS. Is O'Reilly's "Rhino"
book a good starting place?
Regards and thanks.
Here's the relevant code:
print "<FORM ACTION='/cgi-bin/sub_cat_view.cg i' NAME='myform' METHOD=
'get' target='splash' >";
open (CATDAT, "<categories.da t");
while (<CATDAT>){
@categories = split /#/, "$_";
$cat_length = @categories;
$loop=0;
print "<H4>";
while ($loop < $cat_length){
print "<A
HREF='javascrip t:document.myfo rm.submit()'>$c ategories
[$loop]</A><BR>";
print "<INPUT TYPE='hidden' NAME='$categori es[$loop]'
VALUE='cat
egory'>";
$loop++;
}
}
close (CATDAT);
print "</FORM>";
Comment