ezincenter 0 Report post Posted December 10, 2004 Hey everyone, got a problem with a Perl script I'm trying out. In my Perl script, I have the user input a number to dynamically display a number of text form fields in which they enter figures. At the bottom, there will be a button to give the sum of all the numbers in the text fields--that's where I'm stuck, I got the text boxes to show up alright, but that's about it. I thought I might use JavaScript, but that didn't turn out to well. I was thinking of using arrays for the name referencing in the javascript part, but I couldn't figure that out either. Here's the scriptCode: #!/usr/bin/perl -wuse CGI;$query = new CGI;$JSCRIPT=<<EOF;// Any JavaScript Ideas??EOF;print $query->header,"\n";print $query->start_html(-title=>'JavaScript Summations',-script=>$JSCRIPT),"\n";print "<h1>Choose to add up a Summation of costs</h1>\n";print $query->p,"Just enter in the number of items you will need to include then hit "Submit Query" to get the form boxes","\n";print $query->start_form(-name=>'formA',-method=>'get'),"\n";print "<p>How many items?\n";print $query->textfield('item'),"<br />\n";print $query->submit,$query->reset,"</p>\n";$list = $query->param('item');print "<ol>\n";for (1..$list) {print qq{ <li>Input a cost(\$): <input name=\"field$_\" type=\"text\" /></li>\n};}print "</ol>\n\n";print "<input type=\"button\" value=\"Get Sum\" onclick=\"doSum()\" \/>\n\n";print $query->end_form,"\n\n";print $query->end_html; This is like my second serious Perl script and I couldn't think of the syntax that would accomplish my task--I wouldn't even know how to search for it really, but I'll continue to play around with ideas. Thanks, in advance, for any help. Best regards,ezincenter Share this post Link to post Share on other sites