Load the contents of a TD into another TD ADVPL ASP

1

I have a question in a code that uses advpl (Microsiga Protheus) plus HTML.

I need in the html part, that the content of a TD is captured at the time of writing, and is assigned in another TD. Here is the screenshot plus the code snippet:

Inthiscase,whencollectingtheNotekey,autocompletetheNFnumberandserialnumberbytakingtheSUBSTRING26.9nfnumberand23.3NFSeries.

htmlcode

<CENTER><fontface="Arial" size="2" color="#ff0080"><b>REGISTRO DE NF DE SAIDA</b></font></CENTER>

         <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#F3F3F3" width="400" id="AutoNumber10">
          <tr>
            <td width="120"><font face="Arial" size="2" color="#000080"><b>&nbsp;Chave Da NF:</b></font></td>&nbsp;
            <td width="161"><input type="text" name="T2" size="44" MAXLENGTH="44" onblur="jscript:valida(this.value);"></td>
          </tr>
          <tr>
            <td width="120"><font face="Arial" size="2" color="#000080"><b>&nbsp;Numero NF:</b></font></td>&nbsp;
            <td width="161"><input type="text" name="T3" VALUE=" " size="6"></td>
          </tr>
          <tr>
            <td width="120"><font face="Arial" size="2" color="#000080"><b>&nbsp;Serie NF:</b></font></td>&nbsp;
            <td width="161"><input type="text" name="T4" VALUE=" " size="3"></td>
          </tr>
          <tr>
            <td width="120"><font face="Arial" size="2" color="#000080"><b>&nbsp;Status:</b></font></td>&nbsp;
            <td width="161">
                <select size="1" name="STATUS">
                    <option value="S">1= Saída na Portaria</option>
                    <option value="D">2= Devolvido para Estoque</option>
                    <option value="C">3= Cancelamento Cliente</option>
                </select>
            </td>
          </tr> 
        </table>  <br>
        <button name="B1" type="none" onclick='jscript:validaall()'>> Confirma <</button>
        </center> <br>
        <center><a href='H_W10_03_NOVO.APL'><i><b>Voltar ao Menu</b></i></a></center>
      </div>
      </td>
    </tr>
  </table>
  </center>

I would like to thank you for the help.

    
asked by anonymous 15.03.2018 / 14:32

2 answers

3

Thank you Siga0984 ..

I was able to solve, following your tip I had an idea, instead of creating the form, in the function valid, where we already have the data loaded, I passed a substring of the contents of the field of the key of the fiscal note to the (value ) from the other field. As in the html beyond the JavaScript validation as you mentioned, the onblur function is also passed when clicking out of the field is automatically loaded the field Numbers NF and NF Series. Here's the snippet of code for better understanding:

<script> 

function valida(xx)

{

if(xx=='')

alert(' Campo não pode ser vazio !'); 

else

document.form1.T3.value = xx.substr(25,9);

document.form1.T4.value = xx.substr(22,3);

}

</script>
    
16.03.2018 / 13:17
1

In your Html code JavaScript is already being used to validate the nota fiscal key (javacript: valid () function, triggered after the focus is lost in the "NF key" field), and the "total "by means of the validaall () function, triggered by the" Confirm "button.

What you are going to upgrade is not exactly the "TDs" of the tables, but the INPUTs values arranged in the table. To do these events, I would create an HTML form to group the inputs, passing this form as a parameter to the function valid () in Javascript, and inside it would break the value of the field and feed the values of the other inputs of the form.

There is a topic (in English) in StackOverflow itself - link - showing alternatives of how to fill a form field or Html INPUT using JavaScript.

    
16.03.2018 / 10:53