Load the contents of one <TD> onto another <TD> ADVPL ASP

Asked

Viewed 349 times

1

I have a doubt in a code that uses advpl(Microsiga Protheus) more HTML.

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

Registro de Notas de saída

In this precise case that when collecting the Note key, autocomplete the NF Number and Series by taking the SUBSTRING 26.9 nf number and 23.3 NF Series.

Html code

<CENTER><font face="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 already leave my thanks for the help.

2 answers

3

Thank you siga0984..

I managed to solve, following your tip I had an idea, instead of creating the form, in the validate function, where we already have the data loaded, I passed a substring of the contents of the key field of the invoice for the (value) from the other field. As in html besides the validation of Javascript as you mentioned,is also passed the function onblur when clicking outside the field automatically loads the field Number NF and NF Series. Follow the 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>

1

In its Html code, Javascript is already being used to validate the invoice key ( javacript:validate() function, fired after the loss of focus in the "NF Key" field), and the "total" validation through the validaall() function, fired through the "Confirm" button".

What you will update is not exactly the "Tds" of the tables, but the values of the inputs arranged in the table. To do these events, I would create an HTML form to group the inputs, passing this form as parameter to the validate() function in Javascript, and within it would break the field value and feed the values of the other form inputs.

There is a topic (in English) in Stackoverflow itself -- https://stackoverflow.com/questions/7609130/set-the-value-of-an-input-field -- showing alternatives of how to fill in a form field or INPUT Html using Javascript.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.