Changeset 3032 for pykota/trunk/cgi-bin

Show
Ignore:
Timestamp:
10/10/06 22:56:49 (18 years ago)
Author:
jerome
Message:

Added some javascript form validation code to avoid common mistakes
and incompatibilities between output format and data type.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/cgi-bin/dumpykota.cgi

    r3030 r3032  
    4242    <title>%s</title> 
    4343    <link rel="stylesheet" type="text/css" href="/pykota.css" /> 
     44    <script type="text/javascript"> 
     45    <!-- 
     46      function checkvalues()  
     47      { 
     48          if ((document.mainform.format.value == "cups") && (document.mainform.datatype.value != "history")) 
     49          { 
     50              alert("Output format and data type are incompatible."); 
     51              return false; 
     52          } 
     53           
     54          if (document.mainform.sum.checked && (document.mainform.datatype.value != "payments") && (document.mainform.datatype.value != "history")) 
     55          { 
     56              alert("Summarize is only possible for History and Payments."); 
     57              return false; 
     58          } 
     59           
     60          if (document.mainform.sum.checked && (document.mainform.format.value == "cups")) 
     61          { 
     62              alert("Summarize is not possible with CUPS' page_log format."); 
     63              return false; 
     64          } 
     65           
     66          return true; 
     67      } 
     68    //--> 
     69    </script> 
    4470  </head> 
    4571  <body> 
    4672    <p> 
    47       <form action="dumpykota.cgi" method="GET"> 
     73      <form action="dumpykota.cgi" method="GET" name="mainform" onsubmit="return checkvalues()"> 
    4874        <table> 
    4975          <tr>