All

I have to admit defeat on this one and will gladly acknowledge anyone who
solves it as a genius! The Perl script below is part of an application which
can be tested at

http://www.demo.wizz400.com/scripts/cgi-bin/wizz400/wizz400sop.pl

You can login with a user ID of Wizz400 and a password of Wizz400

Type 'br' in the search field and select customer British Gas. Type a
customer order number and press ENTER. Select Maxim Trade and then click OK.

Right heres the problem. I have tried to map function keys (yes those old
fashioned things) to the buttons (because the user doesn't want to have to
reach for the mouse) and in the main these work. However when you type an
order quantity and press F6 the order lines are duplicated, I believe the
page is being submitted twice. Clicking on 'Add to order' works fine.

This is just a demo application (and my Perl is not brilliant) so you can do
no damage, though please don't hack it. Note it may only be available
between 09:00 and 18:00 hours GMT.

Also note I have no idea what will happen when lots of people (all using the
same user ID) access the system. It will probably melt the server and
produce some very odd results (please let me know if you encounter these).

Many thanks, I just need to solve the F6 problem. Sorry the post is such a
size.

Regards

Maurice

<-- source for script follows

############################################################################
####
#  Wizz_sop-030.pl    Customer Order Entry
#
############################################################################
####
sub wizz_sop_030 {

  # parameters passed to this subroutine
  $ORUSR = "$_[0]"; # user id
  $OCLID = "$_[1]"; # prefered customer language
  $ORCTL = "$_[2]"; # catalogue
  $ORCUS = "$_[3]"; # customer number
  $ORCNM = "$_[4]"; # customer name
  $OCUSR = "$_[5]"; # customer user name
  $ORSNO = "$_[6]"; # ship to number
  $ORSNM = "$_[7]"; # ship to name
  $ORBRD = "$_[8]"; # selected brand
  $ORFDS = "$_[9]"; # finish discription
  $ORCOL = "$_[10]"; # colour
  $ORFNS = "$_[11]"; # finish


  # set browser title
  print "<HEAD>";
  print "<TITLE>$browser_title_030</TITLE>";

   # javascript routines
    print "<SCRIPT LANGUAGE=\"JavaScript\" TYPE=\"text/javascript\">";
    # javascript arrays
    print "var cells = new Array();";
    print "var aline = new Array();";
    print "var acol  = new Array();";
    print "var firstline = 0;";
    print "var lastline  = 0;";
    print "var maxcell  = 0;";
    print "var found = \"no\";";
    print "var lr_arrow = \"$function_left_rigth\";";

    print "function focus_cells() {";
     print '   cells = "value[0]";';
     print "   last = document.wizz_sop_030.elements.length - 1;";
     print "   found = false;";
     print "   for (i=0; i<last; i++) {";
     print "       if (document.wizz_sop_030.elements[i].name == cells) {";
     print "          found = true; }";
     print "   }";
     print "   if (found == true) {";
     print "      document.wizz_sop_030.item(cells).focus(); }";
     print "   else {";
     print "      document.wizz_sop_030.COLOUR.focus(); }";
    print "}";

    # javascript to create array with table cells
    print "function add_cell(index, cline, ccol) {";
     print "   next  = \"value[\" + index + \"]\";";
     print "   cells[index] = next;";
     print "   aline[index] = cline;";
     print "   acol[index]  = ccol;";
     print "   if (firstline == 0) {";
     print "      firstline = cline; }";
     print "   lastline     = cline;";
     print "   maxcell      = index;";
    print "}";

    # javascript to find next cell in the table
    print "function find_next(index, direction) {";
     print "   i = index;";
     print "   cline = aline[index];";
     print "   ccol  = acol[index];";
     print "   if (direction == 1  &&  cline < lastline) {";
     print "      while (cline == aline[i]) { i++; }";
     print "      savi = i;";
     print "      nline = aline[i];";
     print "      while (ccol != acol[i]  &&  i < maxcell) { i++; }";
     print "      if (ccol == acol[i]) {";
     print "         return i; }";
     print "      else {";
     print "         i = savi;";
     print "         while (nline == aline[i] && ccol > acol[i]) { i++; }";
     print "         if (nline != aline[i]) { i--; } ";
     print "         return i;";
     print "      }";
     print "   } ";
     print "   if (direction == 2  &&  cline > firstline) {";
     print "      while (cline == aline[i]) { i--; }";
     print "      savi = i;";
     print "      nline = aline[i];";
     print "      while (ccol != acol[i]  &&  i > 1) { i--; }";
     print "      if (ccol == acol[i]) {";
     print "         return i; }";
     print "      else {";
     print "         i = savi;";
     print "         while (nline == aline[i] && ccol < acol[i]) { i--; }";
     print "         if (nline != aline[i]) { i++; } ";
     print "         return i;";
     print "      }";
     print "   } ";
     print "   return index;";
    print "}";

    # javascript for shortcut buttons
    print "function shortcut() {";
     print "   if (event.keyCode == 118) {";            # key F7 - customer
search
     print "      document.wizz_sop_030.button_return_to_search.focus();";
     print "      document.wizz_sop_030.button_return_to_search.click();";
     print "   }";
     print "   if (event.keyCode == 117) {";            # key F6 - Add to
order
     print "      document.wizz_sop_030.button_add_to_order.focus();";
     print "      document.wizz_sop_030.button_add_to_order.click();";
     print "   }";
     print "   if (event.keyCode == 119) {";            # key F8 - Review
order
     print "      last = document.wizz_sop_030.elements.length - 1;";
     print "      found = false;";
     print "      for (i=0; i<last; i++) {";
     print "          if (document.wizz_sop_030.elements[i].name ==
\"button_review_order\") {";
     print "             found = true;";
     print "          }";
     print "      }";
     print "      if (found == true) {";
     print "         document.wizz_sop_030.button_review_order.focus();";
     print "         document.wizz_sop_030.button_review_order.click();";
     print "      }";
     print "   }";
     print "   if (event.keyCode == 120) {";            # key F9 - Tints
     print "      document.wizz_sop_030.button_tints.focus();";
     print "      document.wizz_sop_030.button_tints.click();";
     print "   }";
     print "   if (event.keyCode == 123) {";            # key F12 - Checkout
     print "      last = document.wizz_sop_030.elements.length - 1;";
     print "      found = false;";
     print "      for (i=0; i<last; i++) {";
     print "          if (document.wizz_sop_030.elements[i].name ==
\"button_checkout\") {";
     print "             found = true;";
     print "          }";
     print "      }";
     print "      if (found == true) {";
     print "         document.wizz_sop_030.button_checkout.focus();";
     print "         document.wizz_sop_030.button_checkout.click();";
     print "      }";
     print "   }";
    print "}";

    # javascript to move the cursor with arrows
    print "function move_cursor(index) {";
     print "   shortcut();";
     print "   if (event.keyCode == 40) {";
     print "      index = find_next(index, 1);";
     print "   }";
     print "   if (event.keyCode == 38) {";
     print "      index = find_next(index, 2);";
     print "   }";
     print "   if (event.keyCode == 39 && lr_arrow == \"yes\") {";
     print "      if (index < maxcell) {";
     print "         index = index + 1;";
     print "      }";
     print "   }";
     print "   if (event.keyCode == 9) {";
     print "         return;";
     print "   }";
     print "   if (event.keyCode == 37 && lr_arrow == \"yes\") {";
     print "      if (index > 0) {";
     print "         index = index - 1;";
     print "      }";
     print "   }";
     print "   next  = \"value[\" + index + \"]\";";
     print "   document.wizz_sop_030.item(next).focus();";
    print "}";

    # javascript to validate input stream
    print "function validate() {";
     print "   if (event.keyCode == 13) {";
     print "      document.wizz_sop_030.button_add_to_order.focus();";
     print "      document.wizz_sop_030.button_add_to_order.click();";
     print "      return true;";
     print "   }";
     print "   if (event.keyCode == 27) {";
     print "      return true;";
     print "   }";
     print "   if ((event.keyCode >= 48  &&  event.keyCode <= 57)  ||
event.keyCode == 46) {";
     print "      return true;";
     print "   }";
     print "   alert(\"The order quantity must be numeric\");";
     print "   event.returnValue = false;";
     print "   return false;";
    print "}";

    print "function keyEnter() {";
     print "   if ((event.keyCode >=65  &&  event.keyCode <=90) ||
(event.keyCode >=97  &&  event.keyCode <=122)) {";
     print "      return true;";
     print "   }";
     print "   if (found == \"yes\") {";
     print "      if (event.keyCode == 13) {";
     print "         document.wizz_sop_030.activbutton.focus();";
     print "         document.wizz_sop_030.activbutton.click();";
     print "         return true;";
     print "      }";
     print "      return false;";
     print "   }";
     print "   else {";
     print "      document.wizz_sop_030.activbutton.focus();";
     print "      document.wizz_sop_030.activbutton.click();";
     print "      event.returnValue = false;";
     print "   }";
    print "}";

    print "function ConfirmAbort() {";
     print "   if (confirm(\"This will delete the order. Are you sure?\"))
{";
     print "      return true;";
     print "   }";
     print "   else {";
     print "      event.returnValue = false;";
     print "   }";
    print "}";
   print "</SCRIPT>";
  print "</HEAD>";

  # form method = post, returning to the main script
  print "<FORM NAME=wizz_sop_030 METHOD=POST ACTION=$main_script>";
  print "<BODY onkeydown=shortcut()>";

    # Hidden fields to be returned
    print "<INPUT TYPE=HIDDEN NAME=SUBNM VALUE=\"SUB30\">";
    print "<INPUT TYPE=HIDDEN NAME=ORUSR VALUE=\"$ORUSR\">";
    print "<INPUT TYPE=HIDDEN NAME=OCLID VALUE=\"$OCLID\">";
    print "<INPUT TYPE=HIDDEN NAME=ORCTL VALUE=\"$ORCTL\">";
    print "<INPUT TYPE=HIDDEN NAME=ORCUS VALUE=\"$ORCUS\">";
    print "<INPUT TYPE=HIDDEN NAME=ORCNM VALUE=\"$ORCNM\">";
    print "<INPUT TYPE=HIDDEN NAME=OCUSR VALUE=\"$OCUSR\">";
    print "<INPUT TYPE=HIDDEN NAME=ORSNO VALUE=\"$ORSNO\">";
    print "<INPUT TYPE=HIDDEN NAME=ORSNM VALUE=\"$ORSNM\">";
    print "<INPUT TYPE=HIDDEN NAME=ORBRD VALUE=\"$ORBRD\">";

    print "<INPUT TYPE=HIDDEN NAME=ORAD1 VALUE=\"$ORAD1\">\n";
    print "<INPUT TYPE=HIDDEN NAME=ORAD2 VALUE=\"$ORAD2\">\n";
    print "<INPUT TYPE=HIDDEN NAME=ORAD3 VALUE=\"$ORAD3\">\n";
    print "<INPUT TYPE=HIDDEN NAME=ORAD4 VALUE=\"$ORAD4\">\n";
    print "<INPUT TYPE=HIDDEN NAME=ORPCD VALUE=\"$ORPCD\">\n";

    # print sub title
    print "<H2>$sub_title_030</H2><BR>";

    # Show Customer/ShipTo information
    &wizz_sop_991;

    # Organize Search Screen
    print "<TABLE CELLSPACING=2>";
     print "<COL><COL><COL><COL><COL>";
     # Show brand buttons
     print "<TR><TD>&nbsp</TD></TR>";
     print "<TR>";
      # create empty arrays for buttons
      $numer   = 0;
      $numerln = 0;
      @buttons = ();
      @groups  = ();
      # Open the customer level1 links file
        open (DATABASE, "$wwcmp300") || &CgiDie ("$cgidie");
        # read all catalogue records
        while (<DATABASE>) {
                &parse_wwcmp300;
                if ($L3CUS eq $ORCUS) {
               print "<TD ALIGN=CENTER>";
                if ($ORBRD eq $L3GRP) {
                    print "<INPUT TYPE=HIDDEN NAME=activgroup
VALUE=\"$L3GRP\" STYLE=\" background-color : $button_background\"
onblur=\"this.style.background = \'$button_background\'\"
onfocus=\"this.style.background = \'$select_background\'\">";
                    print "<INPUT CLASS=activ TYPE=SUBMIT NAME=activbutton
VALUE=\"$L3GDS\" STYLE=\" background-color : $button_products_background\"
onblur=\"this.style.background = \'$button_background\'\"
onfocus=\"this.style.background = \'$select_background\'\">";
                }
                else {
                    push(@buttons, $L3GDS);
                    push(@groups, $L3GRP);
                    print "<INPUT TYPE=SUBMIT NAME=buttons[$numer]
VALUE=\"$L3GDS\" STYLE=\" background-color : $button_background\"
onblur=\"this.style.background = \'$button_background\'\"
onfocus=\"this.style.background = \'$select_background\'\">";
                    $numer++;
                }
               $numerln++;
               print "</TD>";
               $remnd = $numerln % 5;
               if ($remnd == 0) {
                 print "</TR><TR>"; }
                }
        } # end while DATABASE
      # close the catalogues file
      close (DATABASE);
     print "</TR>";

     # Show Search field
     print "<TR><TD>&nbsp</TD></TR>";
     print "<TR>";
     print "<TD><P><B>$text_02_030</B></P></TD>";

      # allow selection of finish
      print "<TD>";
       # save the finish
       $SAVFNS = "";
       $selected = "no";
       print "<SELECT NAME=SLFNS>";
        # Open the categories file
        open (DATABASE, "$wwpmp200") || &CgiDie ("$cgidie");
        # read all category records
        while (<DATABASE>) {
              &parse_wwpmp200;
              if ($P2GRP eq $ORBRD) {
                 if ($SAVFNS eq "") {
                    $SAVFNS = $P2CAT;
                 }
                 $value=$P2CAT . "," . $P2DSC;
                 if ($P2CAT eq $ORFNS) {
                       $selected = "yes";
                       print "<OPTION SELECTED VALUE=$value>$P2DSC";
                 }
                 else {
                    print "<OPTION VALUE=$value>$P2DSC";
                 }
              }
        } # end while DATABASE
        # close the catalogues file
        close (DATABASE);
      print "</SELECT>";
       if ($selected eq "no") {
          $ORFNS = $SAVFNS;
       }
      print "</TD>";

      print "<TD><P><B>$text_03_030</B></P></TD>";
      print "<TD><INPUT TYPE=TEXT NAME=COLOUR VALUE=\"$ORCOL\"
onkeypress=keyEnter() onblur=\"this.style.background =
\'$unselect_background\'\" onfocus=\"this.style.background =
\'$select_background\'\"></TD>";
      print "</TR>";
      print "<INPUT TYPE=HIDDEN NAME=groups VALUE=\"@groups\">";
     print "</TABLE>";

    # Show the table
     print "<TABLE CELLSPACING=2>";
     print "<TR>";
      # leave blank column for colours
      print "<TD></TD>";
      # Show pack size
      ## Get information for finishes table
      $col = 0;
      @packsize = ();
      open (DATABASE, "$wwpmp200") || &CgiDie ("$cgidie");
      # read all category records
      while (<DATABASE>) {
            &parse_wwpmp200;

            # find selectes finish
            if ($P2GRP eq $ORBRD) {
             if ($P2CAT eq $ORFNS) {  # XX000
               if ($P2DH1 ne "") {
                  push(@packsize, $P2DH1);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH1</FONT></TD>";
                  $col = 1;
               }
               else {
                  last; }
               if ($P2DH2 ne "") {
                  push(@packsize, $P2DH2);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH2</FONT></TD>";
                  $col = 2;
               }
               else {
                  last; }
               if ($P2DH3 ne "") {
                  push(@packsize, $P2DH3);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH3</FONT></TD>";
                  $col = 3;
               }
               else {
                  last; }
               if ($P2DH4 ne "") {
                  push(@packsize, $P2DH4);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH4</FONT></TD>";
                  $col = 4;
               }
               else {
                  last; }
               if ($P2DH5 ne "") {
                  push(@packsize, $P2DH5);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH5</FONT></TD>";
                  $col = 5;
               }
               else {
                  last; }
               if ($P2DH6 ne "") {
                  push(@packsize, $P2DH6);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH6</FONT></TD>";
                  $col = 6;
               }
               else {
                  last; }
               if ($P2DH7 ne "") {
                  push(@packsize, $P2DH7);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH7</FONT></TD>";
                  $col = 7;
               }
               else {
                  last; }
               if ($P2DH8 ne "") {
                  push(@packsize, $P2DH8);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH8</FONT></TD>";
                  $col = 8;
               }
               else {
                  last; }
               if ($P2DH9 ne "") {
                  push(@packsize, $P2DH9);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DH9</FONT></TD>";
                  $col = 9;
               }
               else {
                  last; }
               if ($P2DHA ne "") {
                  push(@packsize, $P2DHA);
                  print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$P2DHA</FONT></TD>";
                  $col = 10;
               }
               last;
             }  # XX000
            }
      } # end while DATABASE
      # close the catalogues file
      close (DATABASE);
     print "</TR>";

     if ($col == 0) {
         print "<TR><TD>&nbsp</TD></TR>";
         print "<TR><TD><B><P>$text_04_030</P></B></TD></TR>";
         print "<TR><TD>&nbsp</TD></TR>";
     }
     else {
        # Open the product level3 file
        open (DATABASE, "$wwpmp300") || &CgiDie ("$cgidie");
        @products = ();
        $prddsc = "";
        @value = ();
        $i = 0;  # element number
        $j = 0;  # line number
        $k = 0;  # heading lines
        $quan = "disabled";
        # read all level3 records
        while (<DATABASE>) {
              &parse_wwpmp300;
              $valid = "no";
              if ($P3GRP eq $ORBRD  &&  $P3CAT eq $ORFNS) {
                 if ($ORCOL ne "") {
                    if ($P3DSC =~ m/$ORCOL/i) {
                       $valid = "yes"; }
                 }
                 else {
                    $valid = "yes"; }
              }
              # Show valid products
              if ($valid eq "yes") {
                 # show headings
                 if ($k ==  $lines_on_headings) {
                    print "<TR><TD>&nbsp</TD></TR>";
                    print "<TR>";
                     # leave blank column for colours
                     print "<TD></TD>";
                     # displey the pack size heading
                     for ($l = 0; $l < $col; $l++) {
                        print "<TD ALIGN=LEFT
BGCOLOR=$table_heading_background_color><FONT
COLOR=$table_heading_font_color>$packsize[$l]</FONT></TD>";
                     }
                    print "</TR>";
                    $k = 0;
                 }
                 $k++;
                 # show the line
                 print "<TR>";
                  print "<SCRIPT LANGUAGE=\"JavaScript\"> found = \"yes\";
</SCRIPT>";
                  $j++;
                  print "<TD><P><B>$P3DSC</B></P></TD>";
                  #$maincod = $P3GRP.$P3CAT.$P3SUB."-";
                  $maincod = $P3GRP.$P3CAT.$P3SUB;
                  if ($P3DH1 eq "Y") {
                     $prdcod = $maincod.$P3DV1;
                     $prddsc = $prddsc.$P3DSC." ".$packsize[0].",";
                     push(@products, $prdcod);
                     push(@value, 0);
                     print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,1); </SCRIPT>";
                     print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                     $i++; }
                  else {
                     print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  if (2 <= $col) {
                     if ($P3DH2 eq "Y") {
                        $prdcod = $maincod.$P3DV2;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[1].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,2); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                  if (3 <= $col) {
                     if ($P3DH3 eq "Y") {
                        $prdcod = $maincod.$P3DV3;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[2].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,3); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                  if (4 <= $col) {
                     if ($P3DH4 eq "Y") {
                        $prdcod = $maincod.$P3DV4;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[3].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,4); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                  if (5 <= $col) {
                     if ($P3DH5 eq "Y") {
                        $prdcod = $maincod.$P3DV5;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[4].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,5); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                  if (6 <= $col) {
                     if ($P3DH6 eq "Y") {
                        $prdcod = $maincod.$P3DV6;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[5].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,6); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                  if (7 <= $col) {
                     if ($P3DH7 eq "Y") {
                        $prdcod = $maincod.$P3DV7;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[6].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,7); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                  if (8 <= $col) {
                     if ($P3DH8 eq "Y") {
                        $prdcod = $maincod.$P3DV8;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[7].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,8); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                  if (9 <= $col) {
                     if ($P3DH9 eq "Y") {
                        $prdcod = $maincod.$P3DV9;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[8].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,9); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                  if (10 <= $col) {
                     if ($P3DHA eq "Y") {
                        $prdcod = $maincod.$P3DVA;
                        $prddsc = $prddsc.$P3DSC." ".$packsize[9].",";
                        push(@products, $prdcod);
                        push(@value, 0);
                        print "<SCRIPT LANGUAGE=\"JavaScript\">
add_cell($i,$j,10); </SCRIPT>";
                        print "<TD><INPUT TYPE=TEXT NAME=value[$i]
SIZE=\"$field_length\" onkeydown=move_cursor($i) onkeypress=validate()
onblur=\"this.style.background = \'$unselect_background\'\"
onfocus=\"this.style.background = \'$select_background\'\"></TD>";
                        $i++; }
                     else {
                        print "<TD><INPUT CLASS=disabled DISABLED TYPE=TEXT
NAME=$quan SIZE=\"$field_length\"></TD>"; }
                  }
                 print "</TR>";
              }
          } # end while DATABASE
        # close the catalogues file
        close (DATABASE);
        # return product names
        print "<INPUT TYPE=HIDDEN NAME=products VALUE=\"@products\">";
        print "<INPUT TYPE=HIDDEN NAME=prddesc VALUE=\"$prddsc\">";
     }
    print "</TABLE>";
    print "<BR>";

    # Display the buttons
    print "<TABLE CELLPADDING=2 CELLSPACING=2>";
     print "<TR>";
      print "<TD>";
       print "<TABLE CELLPADDING=2 CELLSPACING=2>";
        print "<TR>";
         print "<TD>";
          print "<INPUT TYPE=SUBMIT CLASS=\"submit\" ACCESSKEY=\"S\"
NAME=button_return_to_search VALUE=\"$button_text_customer_search\" STYLE=\"
background-color : $button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\">";
          print "<B CLASS=\"shortcut\">F7</B>";
          print "<U CLASS=\"shortcutS\">S</U>";
         print "</TD>";
        print "</TR>";
        print "<TR>";
         print "<TD ALIGN=CENTER>";
          print "<INPUT TYPE=SUBMIT CLASS=\"submit\" ACCESSKEY=\"T\"
NAME=button_tints VALUE=\"$button_text_tints\" STYLE=\" background-color :
$button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\">";
          print "<B CLASS=\"shortcut\">F9</B>";
          print "<U CLASS=\"shortcutT\">T</U>";
         print "</TD>";
        print "</TR>";
       print "</TABLE>";
      print "</TD>";

      print "<TD>";
       print "<TABLE CELLPADDING=2 CELLSPACING=2>";
        print "<TR>";
         print "<TD>";
          print "<INPUT TYPE=SUBMIT CLASS=\"submit\" ACCESSKEY=\"F\"
NAME=button_clear_form VALUE=\"$button_text_clear_form\" STYLE=\"
background-color : $button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\">";
          print "<U CLASS=\"shortcutF\">F</U>";
         print "</TD>";
        print "</TR>";
        print "<TR>";
         print "<TD>";
          if (-s $wwcop200w) {
             print "<INPUT TYPE=SUBMIT CLASS=\"submit\" ACCESSKEY=\"O\"
NAME=button_abort VALUE=\"$button_text_abort\" onclick=\"ConfirmAbort()\"
STYLE=\" background-color : $button_background\"
onblur=\"this.style.background = \'$button_background\'\"
onfocus=\"this.style.background = \'$select_background\'\">";
             print "<U CLASS=\"shortcutO\">&nbsp&nbsp</U>";
          }
          else {
             print "<INPUT DISABLED TYPE=SUBMIT NAME=button
VALUE=\"$button_text_abort\" STYLE=\" background-color :
$button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\">";
          }
         print "</TD>";
        print "</TR>";
        print "<TR>";
         print "<TD>";
          print "<INPUT TYPE=SUBMIT CLASS=\"submit\" ACCESSKEY=\"A\"
NAME=button_add_to_order VALUE=\"$button_text_add_to_order\" STYLE=\"
background-color : $button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\">";
          print "<B CLASS=\"shortcut\">F6</B>";
          print "<U CLASS=\"shortcutA\">A</U>";
         print "</TD>";
        print "</TR>";
       print "</TABLE>";
      print "</TD>";

      print "<TD>&nbsp</TD>";
      print "<TD>";
       print "<TABLE CELLPADDING=2 CELLSPACING=2>";
        print "<TR>";
         if (-s $wwcop200w) {
            print "<TD ALIGN=CENTER>";
             print "<INPUT TYPE=SUBMIT CLASS=\"submit\" ACCESSKEY=\"R\"
NAME=button_review_order VALUE=\"$button_text_review_order\" STYLE=\"
background-color : $button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\">";
             print "<B CLASS=\"shortcut\">F8</B>";
             print "<U CLASS=\"shortcutR\">P</U>";
            print "</TD>"; }
         else {
            print "<TD><INPUT TYPE=SUBMIT DISABLED NAME=button
VALUE=\"$button_text_review_order\" STYLE=\" background-color :
$button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\"></TD>"; }
        print "</TR>";
        print "<TR>";
         if (-s $wwcop200w) {
            print "<TD ALIGN=CENTER>";
             print "<INPUT TYPE=SUBMIT CLASS=\"submit\" ACCESSKEY=\"C\"
NAME=button_checkout VALUE=\"$button_text_checkout\" STYLE=\"
background-color : $button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\">";
             print "<B CLASS=\"shortcut\">F12</B>";
             print "<U CLASS=\"shortcutC\">C</U>";
            print "</TD>";}
         else {
            print "<TD ALIGN=CENTER><INPUT DISABLED TYPE=SUBMIT NAME=button
VALUE=\"$button_text_checkout\" STYLE=\" background-color :
$button_background\" onblur=\"this.style.background =
\'$button_background\'\" onfocus=\"this.style.background =
\'$select_background\'\"></TD>";}
        print "</TR>";
       print "</TABLE>";
      print "</TD>";
     print "</TR>";
    print "</TABLE>";

    # Catalogue buttons
    print "<BR><BR>";
    print "<TABLE CELLSPACING=2>";
      print "<COL><COL><COL><COL>";
      # create empty arrays for buttons
      $numer   = 0;
      @cbuttons = ();
      @catalogs = ();
      # Show catalogue buttons
      print "<TR>";
       # Open the customer level1 links file
       open (DATABASE, "$wwcmp200") || &CgiDie ("$cgidie");
       # read all catalogue records
       while (<DATABASE>) {
             &parse_wwcmp200;
             if ($L2CUS eq $ORCUS) {
                print "<TD ALIGN=CENTER>";
                push(@cbuttons, $L2CDS);
                push(@catalogs, $L2CTL);
                if ($ORCTL eq $L2CTL) {
                   print "<INPUT DISABLED TYPE=SUBMIT NAME=cbuttons[$numer]
VALUE=\"$L2CDS\" STYLE=\" background-color : $button_background\"
onblur=\"this.style.background = \'$button_background\'\"
onfocus=\"this.style.background = \'$select_background\'\">"; }
                else {
                   print "<INPUT TYPE=SUBMIT NAME=cbuttons[$numer]
VALUE=\"$L2CDS\" STYLE=\" background-color : $button_background\"
onblur=\"this.style.background = \'$button_background\'\"
onfocus=\"this.style.background = \'$select_background\'\">"; }
                $numer++;
                print "</TD>";
                $remnd = $numer % 2;
                if ($remnd == 0) {
                   print "</TR><TR>"; }
             }
       } # end while DATABASE
       # close the catalogues file
       close (DATABASE);
      print "</TR>";
    print "</TABLE>";
    print "<INPUT TYPE=HIDDEN NAME=catalogs VALUE=\"@catalogs\">";

   print "<SCRIPT>";
   print " focus_cells();";
   print "</SCRIPT>";
   print "</BODY>";
  print "</FORM>";

} # end wizz_sop_030 sub
1;




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to