Take the value of a listed <td> (JSP)

Asked

Viewed 244 times

0

Eae guys.

I’m making a system for the college, I wonder if you forum could solve a problem that I’m going through.

My sell screen needs to take the unit price value that is on a chart. The user can put the service he wants that is in a box, by clicking on the service need to automatically pull the unit price. What lists my box is a c:foreach.

<section id="principal">
    <form name="formVendas" method="get" action= "" method="get">
        <h1>Vender</h1>
        <p><label>Nome do serviço:<select id="camposervico" class="tempNome" name="servico">
                    <c:forEach var="servico" items="${dao.listar()}">
                        <option name="${servico.nomeServico}">${servico.nomeServico}</option>
                    </c:forEach>
                </select></label>
            <label>Quantidade:<input type="text" class="tempQuantidade" name="quantidade"></label>
            <label>Preço Unitário:<input type="text" class="tempPrecoUnitario" name="precounitario" ></label>
            <label>Valor total:<input type="text" class="tempInsert"  value="" name="valortotal"></label>
            <button type="button" id="tempBtn" onclick="calcularTotal()">Adicionar</button>
        </p>

        <table width="100%">
            <thead>
                <tr>
                    <th>Serviço</th>
                    <th>Preço Unitário</th>
                    <th>Quantidade</th>
                    <th>Valor Total</th>
                    <th>Remover</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>



    </form>
</section>
<script src="./resources/bootstrap/js/bootstrap.min.js"></script> 

inserir a descrição da imagem aqui

  • Want to take the value when the user puts in the input or when he already clicks on add and appears in the table below?

  • when it chooses in select the service pull the unit price of the service it chose and put in the input

No answers

Browser other questions tagged

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