What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    In my form I want to multiply the following fields:

    Asked by lojaaquinao on June 15, 2013 at 05:16 PM

    In my form I want to multiply the following fields:

     

    Line 1 - Quantidade: * Preço Unitário: = Valor   (Valor = Quantidade: * Preço Unitário:)

    Line 2 - QuantidadeB: * Preço Unitário2: = ValorB (Valor2 = Quantidade2: * Preço Unitário2:)

    Line 3 - QuantidadeC: * Preço Unitário3: = ValorC (Valor3 = Quantidade3: * Preço Unitário3:)

    Line 4 - Quantidade4: * Preço Unitário4: = Valor4 (Valor4 = Quantidade4: * Preço Unitário4:)

    Line 4 - Quantidade5: * Preço Unitário5: = Valor5 (Valor5 = Quantidade5: * Preço Unitário5:)

     

    Line 6 - Custos de Envio:

    TOTAL DA ENCOMENDA = Custos de Envio + Valor + Valor2 + Valor3 +  Valor4 + Valor5

     

    I would appreciate someone can help me solve the problem?

    Thankyou

    Page URL:
    http://form.jotformeu.com/form/31641713065347

    source code multiply values compute value compute fields
  • Profile Image
    JotForm Support

    Answered by jonathan on June 15, 2013 at 09:47 PM

    Hi,

    Please review this thread

    How-can-i-create-add-custom-javascript-to-a-form-to-calculate-fields-  it has a similar requirement to yours. This is an example form from that thread (although the compution is addition) but concept is similar.

    You will have to use your form's source code to accomplish custom computation of values between fields.

    Hope this help. Inform us if you have further inquiry.

    Thanks.

  • Profile Image

    Answered by dwidn on June 17, 2013 at 12:02 PM

    This is the code with the necessary transformations, written in red:

     

    <script src="//cdn.jotfor.ms/static/jotform.js?3.1.797" type="text/javascript"></script>

    <script type="text/javascript">

       JotForm.init(function(){

          JotForm.setCalendar("41");

          JotForm.displayLocalTime("hour_41", "min_41", "ampm_41");

              JotForm.setDateTimeRangeChecker("41","Yes")

    ;                     $('input_34').hint('ex: myname@example.com');

          $('input_57').hint('ex: myname@example.com');

          JotForm.description('input_56', '1 produto   oferece 3 apostas<br />2 produtos oferece 4 apostas<br />3 produtos oferece 5 apostas<br />4 produtos oferece 6 apostas<br />5 produtos oferece 8 apostas');

          JotForm.alterTexts({"alphabetic":"This field can only contain letters","alphanumeric":"This field can only contain letters and numbers.","confirmClearForm":"Você tem certeza que quer limpar este formulário?","confirmEmail":"problema com o endereço de e-mail","email":"Digite um endereço de e-mail válido.","gradingScoreError":"Pontuação total deve ser menor ou igual a ","incompleteFields":"Há campos incompletos ...","inputCarretErrorA":"Input should not be less than the minimum value:","inputCarretErrorB":"Input should not be greater than the maximum value:","lessThan":"Your score should be less than or equal to","maxDigitsError":"The maximum digits allowed is","numeric":"Este campo só pode conter pontos e números","pleaseWait":"Por favor aguarde ...","required":"Este campo é obrigatório","requireEveryRow":"Every row is required.","requireOne":"At least one field required.","submissionLimit":"Sorry! Only one entry is allowed.  Multiple submissions are disabled for this form.","uploadExtensions":"You can only upload following files:","uploadFilesize":"O tamanho do arquivo não pode ser maior que:"});

       });

    </script>

    <link target="_blank" href="http://cdn.jotfor.ms/static/formCss.css?3.1.797" rel="nofollow" rel="stylesheet" type="text/css" />

    <link type="text/css" rel="stylesheet" target="_blank" href="http://cdn.jotfor.ms/css/styles/pastel.css?3.1.797" rel="nofollow" />

    <link type="text/css" media="print" rel="stylesheet" target="_blank" href="http://cdn.jotfor.ms/css/printForm.css?3.1.797" rel="nofollow" />

    <style type="text/css">

        .form-label{

            width:127px !important;

        }

        .form-label-left{

            width:127px !important;

        }

        .form-line{

            padding-top:12px;

            padding-bottom:12px;

        }

        .form-label-right{

            width:127px !important;

        }

        .form-all{

            width:900px;

            background:000;

            color:rgb(82, 75, 58) !important;

            font-family:'Tahoma';

            font-size:11px;

        }

        .form-radio-item label, .form-checkbox-item label, .form-grading-label, .form-header{

            color:#555555;

        }

     

     

     

     

     

    </style>

    <script>

    function somar(){

    form_31641713065347.input_25.value = eval(document.form_31641713065347.input_58.value) * eval(document.form_31641713065347.input_19.value)

    form_31641713065347.input_26.value = eval(document.form_31641713065347.input_59.value) * eval(document.form_31641713065347.input_24.value)

    form_31641713065347.input_21.value = eval(document.form_31641713065347.input_61.value) * eval(document.form_31641713065347.input_27.value)

    form_31641713065347.input_46.value = eval(document.form_31641713065347.input_62.value) * eval(document.form_31641713065347.input_45.value)

    form_31641713065347.input_32.value = eval(document.form_31641713065347.input_25.value) + eval(document.form_31641713065347.input_26.value) + eval(document.form_31641713065347.input_21.value) + eval(document.form_31641713065347.input_46.value) +

    eval(document.form_31641713065347.input_30.value)

    }

    </script>

     

    <link type="text/css" rel="stylesheet" target="_blank" href="http://jotformeu.com/css/styles/buttons/form-submit-button-black_blue.css?3.1.797" rel="nofollow"/>

    <form class="jotform-form" action="http://submit.jotformeu.com/submit/31641713065347/" method="post" name="form_31641713065347" id="31641713065347" accept-charset="utf-8">

      <input type="hidden" name="formID" value="31641713065347" />

      <div class="form-all">

        <ul class="form-section">

          <li class="form-line form-line-column" id="id_40">

            <div id="cid_40" class="form-input-wide">

              <div id="text_40" class="form-html">

                <p><span style="font-size: large;"><strong>

                      Nota de Encomenda

                    </strong></span>

                </p>

              </div>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_41">

            <label class="form-label-top" id="label_41" for="input_41"> Data: </label>

            <div id="cid_41" class="form-input-wide"><span class="form-sub-label-container"><input class="form-textbox" id="day_41" name="q41_data[day]" type="tel" size="2" maxlength="2" value="17" /><span class="date-separate">&nbsp;/</span>

                <label class="form-sub-label" for="day_41" id="sublabel_day"> Dia </label></span><span class="form-sub-label-container"><input class="form-textbox" id="month_41" name="q41_data[month]" type="tel" size="2" maxlength="2" value="06" /><span class="date-separate">&nbsp;/</span>

                <label class="form-sub-label" for="month_41" id="sublabel_month"> Mês </label></span><span class="form-sub-label-container"><input class="form-textbox" id="year_41" name="q41_data[year]" type="tel" size="4" maxlength="4" value="2013" />

                <label class="form-sub-label" for="year_41" id="sublabel_year"> 1989 </label></span><span class="form-sub-label-container"><img alt="Escolha uma data" id="input_41_pick" src="//cdn.jotfor.ms/images/calendar.png" align="absmiddle" />

                <label class="form-sub-label" for="input_41_pick"> &nbsp;&nbsp;&nbsp; </label></span>

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_33">

            <label class="form-label-top" id="label_33" for="input_33">

              Nome ou Designação:<span class="form-required">*</span>

            </label>

            <div id="cid_33" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_33" name="q33_nomeOu33" size="30" />

            </div>

          </li>

          <li class="form-line form-line-column" id="id_37">

            <label class="form-label-top" id="label_37" for="input_37">

              Nº de Contribuinte:<span class="form-required">*</span>

            </label>

            <div id="cid_37" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required, Numeric]" data-type="input-textbox" id="input_37" name="q37_nDe37" size="12" />

            </div>

          </li>

          <li class="form-line form-line-column" id="id_34">

            <label class="form-label-top" id="label_34" for="input_34">

              O seu E-mail:<span class="form-required">*</span>

            </label>

            <div id="cid_34" class="form-input-wide">

              <input type="email" class=" form-textbox validate[required, Email]" id="input_34" name="q34_oSeu34" size="30" />

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_35">

            <label class="form-label-top" id="label_35" for="input_35">

              Morada (Rua e Código Postal):<span class="form-required">*</span>

            </label>

            <div id="cid_35" class="form-input-wide">

              <textarea id="input_35" class="form-textarea validate[required]" name="q35_moradarua" cols="55" rows="2"></textarea>

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_57">

            <label class="form-label-top" id="label_57" for="input_57">

              O E-mail da Loja:<span class="form-required">*</span>

            </label>

            <div id="cid_57" class="form-input-wide">

              <input type="email" class=" form-textbox validate[required, Email]" id="input_57" name="q57_oEmail" size="30" />

            </div>

          </li>

          <li class="form-line form-line-column" id="id_38">

            <label class="form-label-top" id="label_38" for="input_38">

              Código de Apostas (Loja):<span class="form-required">*</span>

            </label>

            <div id="cid_38" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_38" name="q38_codigoDe" size="20" />

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_36">

            <label class="form-label-top" id="label_36" for="input_36">

              Mensagem:<span class="form-required">*</span>

            </label>

            <div id="cid_36" class="form-input-wide">

              <textarea id="input_36" class="form-textarea validate[required]" name="q36_mensagem36" cols="60" rows="6">Solicito os artigos abaixo discriminados e declaro que, nos termos do regulamento dos "Leilões THANKYOU", se eu fizer acertos no leilão a factura deve ser emitida já com os descontos. E se o valor dos prémios ultrapassar o valor da encomenda, desejo receber a factura gratuita em separado, para poder levantar o seu valor em produtos na loja onde efectuei o jogo e dentro do prazo estipulado.</textarea>

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_58">

            <label class="form-label-top" id="label_58" for="input_58">

              Quantidade:<span class="form-required">*</span>

            </label>

            <div id="cid_58" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_58" name="q58_quantidade" size="3" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_5">

            <label class="form-label-top" id="label_5" for="input_5">

              Referência do Produto:<span class="form-required">*</span>

            </label>

            <div id="cid_5" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_5" name="q5_referenciaDo" size="30" />

            </div>

          </li>

          <li class="form-line form-line-column" id="id_19">

            <label class="form-label-top" id="label_19" for="input_19">

              Preço Unitário (€):<span class="form-required">*</span>

            </label>

            <div id="cid_19" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required, Numeric]" data-type="input-textbox" id="input_19" name="q19_precoUnitario19" size="6" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_25">

            <label class="form-label-top" id="label_25" for="input_25">

              Valor (€):<span class="form-required">*</span>

            </label>

            <div id="cid_25" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required, Numeric]" data-type="input-textbox" id="input_25" name="q25_valor" size="6" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_59">

            <label class="form-label-top" id="label_59" for="input_59">

              Quantidade 2:<span class="form-required">*</span>

            </label>

            <div id="cid_59" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_59" name="q59_quantidade259" size="3" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_23">

            <label class="form-label-top" id="label_23" for="input_23"> Referência do Produto 2: </label>

            <div id="cid_23" class="form-input-wide">

              <input type="text" class=" form-textbox" data-type="input-textbox" id="input_23" name="q23_referenciaDo23" size="30" />

            </div>

          </li>

          <li class="form-line form-line-column" id="id_24">

            <label class="form-label-top" id="label_24" for="input_24"> Preço Unitário 2 (€): </label>

            <div id="cid_24" class="form-input-wide">

              <input type="text" class=" form-textbox validate[Numeric]" data-type="input-textbox" id="input_24" name="q24_precoUnitario24" size="6" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_26">

            <label class="form-label-top" id="label_26" for="input_26"> Valor 2 (€): </label>

            <div id="cid_26" class="form-input-wide">

              <input type="text" class=" form-textbox validate[Numeric]" data-type="input-textbox" id="input_26" name="q26_valor2" size="6" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_61">

            <label class="form-label-top" id="label_61" for="input_61">

              Quantidade 3:<span class="form-required">*</span>

            </label>

            <div id="cid_61" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_61" name="q61_quantidade3" size="3" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_28">

            <label class="form-label-top" id="label_28" for="input_28"> Referência do Produto 3: </label>

            <div id="cid_28" class="form-input-wide">

              <input type="text" class=" form-textbox" data-type="input-textbox" id="input_28" name="q28_referenciaDo28" size="30" />

            </div>

          </li>

          <li class="form-line form-line-column" id="id_27">

            <label class="form-label-top" id="label_27" for="input_27"> Preço Unitário 3 (€): </label>

            <div id="cid_27" class="form-input-wide">

              <input type="text" class=" form-textbox validate[Numeric]" data-type="input-textbox" id="input_27" name="q27_precoUnitario" size="6" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_21">

            <label class="form-label-top" id="label_21" for="input_21"> Valor 3 (€): </label>

            <div id="cid_21" class="form-input-wide">

              <input type="text" class=" form-textbox validate[Numeric]" data-type="input-textbox" id="input_21" name="q21_valor3" size="6" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_62">

            <label class="form-label-top" id="label_62" for="input_62">

              Quantidade 4:<span class="form-required">*</span>

            </label>

            <div id="cid_62" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_62" name="q62_quantidade4" size="3" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_44">

            <label class="form-label-top" id="label_44" for="input_44"> Referência do Produto 4: </label>

            <div id="cid_44" class="form-input-wide">

              <input type="text" class=" form-textbox" data-type="input-textbox" id="input_44" name="q44_referenciaDo44" size="30" />

            </div>

          </li>

          <li class="form-line form-line-column" id="id_45">

            <label class="form-label-top" id="label_45" for="input_45"> Preço Unitário 4 (€): </label>

            <div id="cid_45" class="form-input-wide">

              <input type="text" class=" form-textbox validate[Numeric]" data-type="input-textbox" id="input_45" name="q45_precoUnitario45" size="6" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_46">

            <label class="form-label-top" id="label_46" for="input_46"> Valor 4 (€): </label>

            <div id="cid_46" class="form-input-wide">

              <input type="text" class=" form-textbox validate[Numeric]" data-type="input-textbox" id="input_46" name="q46_valor4" size="6" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_56">

            <label class="form-label-top" id="label_56" for="input_56">

              Quantos Produtos indicou ?<span class="form-required">*</span>

            </label>

            <div id="cid_56" class="form-input-wide"><span class="form-sub-label-container"><select class="form-dropdown validate[required]" style="width:150px" id="input_56" name="q56_quantosProdutos">

                  <option value="">  </option>

                  <option value="1 Produto"> 1 Produto </option>

                  <option value="2 Produtos"> 2 Produtos </option>

                  <option value="3 Produtos"> 3 Produtos </option>

                  <option value="4 Produtos"> 4 Produtos </option>

                  <option value="5 Produtos"> 5 Produtos </option>

                  <option value="--------------"> -------------- </option>

                  <option value="Seleccionar"> Seleccionar </option>

                </select>

                <label class="form-sub-label" for="input_56"> Quantos mais produtos mais apostas gratuitas você pode jogar. </label></span>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_30">

            <label class="form-label-top" id="label_30" for="input_30">

              Custo do Envio (€):<span class="form-required">*</span>

            </label>

            <div id="cid_30" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required, Numeric]" data-type="input-textbox" id="input_30" name="q30_custoDo30" size="10" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column" id="id_32">

            <label class="form-label-top" id="label_32" for="input_32">

              Total a Pagar (€):<span class="form-required">*</span>

            </label>

            <div id="cid_32" class="form-input-wide">

              <input type="text" class=" form-textbox validate[required, Numeric]" data-type="input-textbox" id="input_32" name="q32_totalA" size="10" onkeyup="somar();"><br>

            </div>

          </li>

          <li class="form-line form-line-column form-line-column-clear" id="id_2">

            <div id="cid_2" class="form-input-wide">

              <div style="text-align:left" class="form-buttons-wrapper">

                <button id="input_2" type="submit" class="form-submit-button form-submit-button-black_blue">

                  Encomendar e Jogar nos LEILÕES THANKYOU »

                </button>

              </div>

            </div>

          </li>

          <li style="clear:both">

          </li>

          <li style="display:none">

            Should be Empty:

            <input type="text" name="website" value="" />

          </li>

        </ul>

      </div>

      <input type="hidden" id="simple_spc" name="simple_spc" value="31641713065347" />

      <script type="text/javascript">

      document.getElementById("si" + "mple" + "_spc").value = "31641713065347-31641713065347";

      </script>

      <input type="hidden" class="form-hidden" value="109" id="input_39" name="q39_nDe" />

     

    </form>

  • Profile Image

    Answered by sidharth_kch on June 17, 2013 at 01:04 PM

    @dwidn

    Request you to please let us know what issues are you facing with this code. We will help you resolve that.

    Do you want us to provide you a workaround on this?

    Thanks,

    Sidharth

  • Profile Image

    Answered by sidharth_kch on June 17, 2013 at 02:02 PM

    @dwidn

    For some reason, your response came out empty. Request you to please post it again.

    Thanks,

    Sidharth

  • Profile Image

    Answered by sidharth_kch on June 18, 2013 at 06:18 AM

    @dwidn

    I created a sample calculation form for you. Please check this URL:

    https://shots.jotform.com/sidharth/Multiplication_(31682880729869)/Multiplication.html

    Thanks,

    Sidharth