Help!! Thank you!!!

Halo, i am doing a JSP program with Java script. Here i am facing some problems to passing the value for checking purposes.
Basically, i want to retrieve value from database and pass to JS function to check whether have any "empty value" or not. If got "empty value" then will call user to enter any value to that fields.
Here is my coding...
notes:
1. the value show using <input type="text field" is correct.
2. i am using for loop in the JS function for checking if more than 1 record..
JSP Program
String sql_query3 = "SELECT mry_fr_dte,mry_to_dte,mry_bud_qty,mry_bud_amt,mry_rate "+
               " FROM mrbudf  "+
               " WHERE mry_item_num= '"+itemcode+"' "+
                "GROUP BY mry_fr_dte,mry_to_dte "+
                        "ORDER BY mry_fr_dte ";
          try {
                getAllDetail2=db.execSQL(sql_query3);
          catch(Exception e){
               System.out.println("Error :"+e);
while(getAllDetail2.next()){
      mry_fr_dte=getAllDetail2.getDate("mry_fr_dte");
      mry_to_dte=getAllDetail2.getDate("mry_to_dte");
     String mry_bud_qty =getAllDetail2.getString("mry_bud_qty");
     String mry_bud_amt =getAllDetail2.getString("mry_bud_amt");
      String mry_rate =getAllDetail2.getString("mry_rate");
      //String date_mry_fr_dte =datefromat.format(mry_fr_dte);
     // String date_mry_to_dte =datefromat.format(mry_to_dte);
     %>
  <tbody>
     <tr>
          <td width = "3%" align = "center"> <%=i%></td>
          <td align="center" width = "17%">
      <input type="text" name="txtfromdate<%=i%>" value="<%=datefromat.format(mry_fr_dte)%>" maxlength = "10" style="width:100%;text-align:center;"   >
               <input type="hidden" name="temp_txtfromdate<%=i%>" value="<%=datefromat.format(mry_fr_dte)%>">
    </td>
    <td align="center" width = "13%">
      <input type="text" name="txttodate<%=i%>" value="<%=datefromat.format(mry_to_dte)%>" maxlength = "10" style="width:100%;text-align:center;"  >
               <input type="hidden" name="temp_txttodate<%=i%>" value="<%=datefromat.format(mry_to_dte)%>">
    </td>
          <td align="center" width = "15%">
               <input type="text" name="rate<%=i%>" value="<%=mry_rate%>" style="width:100%;text-align:right;"  >
               <input type="hidden" name="temp_rate<%=i%>" value="<%=mry_rate%>">
    </td>
    <td align="center" width = "15%">
      <input type="text" name="quantity<%=i%>" value="<%=mry_bud_qty%>" style="width:100%;text-align:right;" >
               <input type="hidden" name="temp_quantity<%=i%>" value="<%=mry_bud_qty%>">
    </td>
          <td width = "15%" align ="center">
     <input type="text" name="amount<%=i%>" value= "<%=mry_bud_amt%>" style="width:100%;text-align:right;" >
          <input type="hidden" name="temp_amount<%=i%>" value="<%=mry_bud_amt%>">
    </td>
</tr>     
  </tbody>
  <%i++;
     }//end while(getAllDetail2.next()
<input type="hidden" name ="curTotalRec" value="<%=i%>">
JS function ( when i call confirmation
function confirmationEdit(curTotalRec){
     window.event.returnValue=false;
var countNull =1;
var total=curTotalRec;
var total_rec=parseInt(eval("document.all.curTotalRec").value);// total retrieved records
//document.writeln("value:"+total_rec);
     for(var i=1;i<=total_rec;i++){
     document.writeln("txtfromdate :"+eval("document.mrbudf.txtfromdate"+i).value);
          document.writeln("txttodate :"+eval("document.mrbudf.txttodate"+i).value);
          document.writeln("rate :"+eval("document.mrbudf.rate"+i).value);
          document.writeln("quantity :"+eval("document.mrbudf.quantity"+i).value);
          document.writeln("amount :"+eval("document.mrbudf.amount"+i).value);A prompt reply will be appreciate.... thank you very much.......

.@_ is right, you provide too little detail to answer your question... like what is the problem.
So for a general answer:
1) Try to avoid client side (javascript) validation. It will fail if the user turns off javascript of decides to maliciously fool the system (by inserting his own javascript calls)
2) Try to keep sql out of JSP. JSP is for display only. You should try to move the SQL into an external object that handles the query for you. Let this external class do the database queries, fill in a collection of data which you then send to the JSP. Best would be to use a servlet to access this data access object, so the JSP just knows about some basic java collection in the request scope (or some other scope). For more information do a search for MVC pattern (Model View Controller).

Similar Messages

Maybe you are looking for