Question anyone can give an idea/code updating HTML table content (- from progress table for each loop ) through an embedded sped script

anyone can give an idea/code updating HTML table content (- from progress table for each loop ) through an embedded sped script and that entered date should update progress table . and that value should reflect in a webpage.
below code is not refreshing table content but it's updating back end data.
Sample embedded speed script of mine
Code:
<!DOCTYPE html>
<html >
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta charset="UTF-8">
  <title>Supplier Workbench</title>
  <style>
   table, th, td {
   border: 1px solid black;
   border-collapse: collapse;
   }
   th, td {
   padding: 5px;
   text-align: left;
   }
   table#t01 {
   width: 100%;   
   background-color: #f1f1c1;
   }
</style>

</head>
<body>
<h1>Supplier Workbench</h1>
<!--wss
IF get-value("CustNum") NE "" then
  for first code_mstr
    WHERE code_mstr.code_fldname = string(get-value("CustNum")) : end.
    -->
<form NAME = "main_form" action="" method="">
  <p>
  Purchase Number: <input name="CustNum" size="20"
  value="`IF AVAILABLE(code_mstr) THEN STRING(code_mstr.code_fldname) ELSE ""`"/>
  <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  Group ID: <input name="GroupID" size="20" value=""/>
  <input type="SUBMIT" name="Button" value="Find"/>
  <br/><br/>
  </p>
  <!--wss
  define buffer buf_code_mstr for code_mstr.
  define temp-table tt_temp
  fields tcode_count   as int
  fields tcode_fldname as character
  fields tcode_value as character
  fields tcode_cmmt as character.
  define variable vcount as int no-undo.
  IF AVAILABLE(code_mstr) THEN do:
  for each buf_code_mstr exclusive-lock where buf_code_mstr.code_fldname = code_mstr.code_fldname
  break by buf_code_mstr.code_fldname:
  vcount = vcount + 1.
  create tt_temp.
  assign
      tcode_count    = vcount
      tcode_fldname  = buf_code_mstr.code_fldname
      tcode_value    = buf_code_mstr.code_value
      tcode_cmmt     = buf_code_mstr.code_cmmt.
  end.
  for each tt_temp break by tcode_fldname:
  if first-of(tcode_fldname) then do:
  -->
  <table id="myTable">
  <thead>
  <tr>  
    <th colspan="3">CODE MASTER1</th>
    <th colspan="2">CODE MASTER2</th>
  </tr>
  </thead>
  <tbody>
  <!--wss
  end.
  -->
  <INPUT TYPE = "HIDDEN" NAME = "fldcount" VALUE = "`tcode_count`">
  <tr id="row1">
    <td>`tcode_fldname`</td>
    <td>`tcode_value`</td>
    <td><input name="cmmt" id="cmmt" size="20" value="`tcode_cmmt`"/></td>
    <td>`tcode_fldname`</td>
    <td>`tcode_value`</td>   
  </tr>
  </tbody>
  <!--wss
  end.
  -->
  </table>
  <br/><br/>
  <input type="SUBMIT" name="Button" value="Save" onclick="myFunction()"/>
  <!--wss
  END. 
  -->
</form>
<script LANGUAGE="javascript">
function myFunction() {
<!--wss
  define variable vpo as character no-undo.
  define variable vpo1 as character no-undo.
  define variable k    as integer   no-undo.
  vpo = get-value("cmmt").
  vpo1 = get-value("fldcount").
  IF get-value("Button") = "Save" THEN do:
   do k = 1 to num-entries(vpo1) :
      for first tt_temp where tcode_count = int(entry(k,vpo1)):
         for first code_mstr exclusive-lock
            where code_fldname = tcode_fldname
               and code_value   = tcode_value :
               assign
               code_cmmt = entry(k,vpo).               
         end.     
      end.
   end.
  end. 
-->
}
</script>

</body>
</html>
 
Last edited by a moderator:
anyone can give an idea/code updating HTML table content (- from progress table for each loop ) through an embedded sped script and that entered date should update progress table . and that value should reflect in a webpage.
below code is not refreshing table content but it's updating back end data.
Sample embedded speed script of mine
Code:
<!DOCTYPE html>
<html >
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta charset="UTF-8">
  <title>Supplier Workbench</title>
  <style>
   table, th, td {
   border: 1px solid black;
   border-collapse: collapse;
   }
   th, td {
   padding: 5px;
   text-align: left;
   }
   table#t01 {
   width: 100%;  
   background-color: #f1f1c1;
   }
</style>

</head>
<body>
<h1>Supplier Workbench</h1>
<!--wss
IF get-value("CustNum") NE "" then
  for first code_mstr
    WHERE code_mstr.code_fldname = string(get-value("CustNum")) : end.
    -->
<form NAME = "main_form" action="" method="">
  <p>
  Purchase Number: <input name="CustNum" size="20"
  value="`IF AVAILABLE(code_mstr) THEN STRING(code_mstr.code_fldname) ELSE ""`"/>
  <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  Group ID: <input name="GroupID" size="20" value=""/>
  <input type="SUBMIT" name="Button" value="Find"/>
  <br/><br/>
  </p>
  <!--wss
  define buffer buf_code_mstr for code_mstr.
  define temp-table tt_temp
  fields tcode_count   as int
  fields tcode_fldname as character
  fields tcode_value as character
  fields tcode_cmmt as character.
  define variable vcount as int no-undo.
  IF AVAILABLE(code_mstr) THEN do:
  for each buf_code_mstr exclusive-lock where buf_code_mstr.code_fldname = code_mstr.code_fldname
  break by buf_code_mstr.code_fldname:
  vcount = vcount + 1.
  create tt_temp.
  assign
      tcode_count    = vcount
      tcode_fldname  = buf_code_mstr.code_fldname
      tcode_value    = buf_code_mstr.code_value
      tcode_cmmt     = buf_code_mstr.code_cmmt.
  end.
  for each tt_temp break by tcode_fldname:
  if first-of(tcode_fldname) then do:
  -->
  <table id="myTable">
  <thead>
  <tr> 
    <th colspan="3">CODE MASTER1</th>
    <th colspan="2">CODE MASTER2</th>
  </tr>
  </thead>
  <tbody>
  <!--wss
  end.
  -->
  <INPUT TYPE = "HIDDEN" NAME = "fldcount" VALUE = "`tcode_count`">
  <tr id="row1">
    <td>`tcode_fldname`</td>
    <td>`tcode_value`</td>
    <td><input name="cmmt" id="cmmt" size="20" value="`tcode_cmmt`"/></td>
    <td>`tcode_fldname`</td>
    <td>`tcode_value`</td>  
  </tr>
  </tbody>
  <!--wss
  end.
  -->
  </table>
  <br/><br/>
  <input type="SUBMIT" name="Button" value="Save" onclick="myFunction()"/>
  <!--wss
  END.
  -->
</form>
<script LANGUAGE="javascript">
function myFunction() {
<!--wss
  define variable vpo as character no-undo.
  define variable vpo1 as character no-undo.
  define variable k    as integer   no-undo.
  vpo = get-value("cmmt").
  vpo1 = get-value("fldcount").
  IF get-value("Button") = "Save" THEN do:
   do k = 1 to num-entries(vpo1) :
      for first tt_temp where tcode_count = int(entry(k,vpo1)):
         for first code_mstr exclusive-lock
            where code_fldname = tcode_fldname
               and code_value   = tcode_value :
               assign
               code_cmmt = entry(k,vpo).              
         end.    
      end.
   end.
  end.
-->
}
</script>

</body>
</html>
The call to "myFunction" does not work as you think. MyFunction is javascript code, not ABL code.
 
Top