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

    Calculating JSON data and adding the results after submision to the spreadsheet.

    Asked by cryptoDude  on February 27, 2014 at 02:11 PM

    Hello!

    I was seeking for some info but wast able to complete everyting on my own. I have a simple order form for Bitcoin purchase. The current bitcoin price is always retrieved via PHP JSON function. The thing i wanted to figure out is how could i implement that :

    1. When a user enters a desired bitcoin amount it would read the current price

    2. Update the sum to pay field current price * X BTC

    3. This info would go in to my spreadsheet.

    Any help would be very appreciated i can provide my code if needed.                                                                                     

     

     

     

     

     

     

     

    Best regards!

    Screenshot
    and order form purchase hello 3
  • Profile Image
    JotForm Support

    Answered by EltonCris on February 27, 2014 at 04:12 PM

    Hi,

    First off, thanks for using Jotform!

    That's possible if you take and modify your form source code. After creating the form in the form builder, just copy your form source code by following this guide: http://www.jotform.com/help/104-How-to-Download-a-Source-Code-of-your-Form

    After that, you can inject custom scripts to your form source code along with the PHP function to retrieved the current price and have it multiply with a piece of javascript codes. It'd be great if you could start over and update us here if you need further assistance with the calculation.

    We'll await your reply. Regards!

  • Profile Image

    Answered by cryptoDude  on February 28, 2014 at 03:35 AM
    Hello this is how my form looks i retrieve my price with <?php echo $usd; ?>. Maybe I could get some headstart on how to implement this calculation. Thank you in advance.
    Order form

    Bitcoin price USD:

    Total Sum :

    Email:
    Bitcoin amount:
    Bitcoin address:
    I Agree to receive news letter
    ORDER!
    Should be Empty:

  • Profile Image

    Answered by crypoDude  on February 28, 2014 at 03:45 AM

    It seems i have some problems posting all code from the form

    [code]
              <h2 id="header_13" class="form-header">
                Order form
              </h2>
            </div>
          </li>
          <li class="form-line" id="id_15">
            <div id="cid_15" class="form-input-wide">
              <div id="text_15" class="form-html">
                <p>
                  <strong>
                   Bitcoin price USD:<?php echo $usd; ?>
                  </strong>
                </p>
              </div>
            </div>
          </li>
          <li class="form-line" id="id_18">
            <div id="cid_18" class="form-input-wide">
              <div id="text_18" class="form-html">
                <p>
                  <strong>
                    Total Sum :
                  </strong>
                </p>
              </div>
            </div>
          </li>
          <li class="form-line" id="id_3">
            <label class="form-label-top" id="label_3" for="input_3"> Email: </label>
            <div id="cid_3" class="form-input-wide">
              <input type="email" class=" form-textbox validate[Email]" id="input_3" name="q3_elPastas" size="25" value="" maxlength="38" />
            </div>
          </li>
          <li class="form-line" id="id_9">
            <label class="form-label-top" id="label_9" for="input_9"> Bitcoin amount: </label>
            <div id="cid_9" class="form-input-wide">
              <input type="text" class=" form-textbox validate[Numeric]" data-type="input-textbox" id="input_9" name="q9_pasirinktosValiutos9" size="25" value="" />
            </div>
          </li>
          <li class="form-line" id="id_10">
            <label class="form-label-top" id="label_10" for="input_10"> Bitcoin address: </label>
            <div id="cid_10" class="form-input-wide">
              <input type="text" class=" form-textbox validate[AlphaNumeric]" data-type="input-textbox" id="input_10" name="q10_bitcoinAdresas10" size="25" value="" maxlength="37" />
            </div>
          </li>
          <li class="form-line" id="id_14">
            <label class="form-label-top" id="label_14" for="input_14">  </label>
            <div id="cid_14" class="form-input-wide">
              <div class="form-single-column"><span class="form-checkbox-item" style="clear:left;"><input type="checkbox" class="form-checkbox" id="input_14_0" name="q14_input14[]" value="I Agree to receive newsletter" />
                  <label for="input_14_0">I Agree to receive news letter </label></span><span class="clearfix"></span>
              </div>
            </div>
          </li>
          <li class="form-line" id="id_12">
            <div id="cid_12" class="form-input-wide">
              <div style="width:100%; text-align:Left;">
                <script id="jcf_custom_field" type="text/javascript" src="//js.jotform.com/WidgetsServer.min.js"></script>
                <iframe onload="widgetFrameLoaded(12)" frameborder="0" scrolling="no" class="custom-field-frame" id="customFieldFrame_12" src="" style="border:none;width:400px; height: 45px">
                </iframe>
                <div>
                  <input id="input_12" class="form-hidden widget-required form-widget" type="hidden" name="q12_clickTo" value="">
                </div>
               
              </div>
            </div>
          </li>
          <li class="form-line" id="id_2">
            <div id="cid_2" class="form-input-wide">
              <div style="text-align:center" class="form-buttons-wrapper">
                <button id="input_2" type="submit" class="form-submit-button">
                  ORDER!
                </button>
              </div>
            </div>
          </li>
          <li style="display:none">
            Should be Empty:
            <input type="text" name="website" value="" />
          </li>
        </ul>
      </div>
      [/code]

  • Profile Image
    JotForm Support

    Answered by KadeJM on February 28, 2014 at 11:02 AM

    I'm curious to know more about the bitcoin pricing you have set up. Is it always going to be just one amount that is then carried over to the Sum such as the $587.98 you have in your first image that is grabbed from your bitcoin pricing? If not then would there be more added to that for the Sum? Or?

    I think that this would take some time to try to figure out something if anything. I will also converse it with some of my colleagues that are a bit more experienced then I am with this type of custom programming to see if there's a better solution and if we can figure out something more for it we'll certainly get back to you as soon as we can.

  • Profile Image

    Answered by cryptomain on February 28, 2014 at 11:42 AM

    Hello !
    No its is updating every mintune. So what i would like to do is if a person writes to bitcoin amount 2 the sum to pay field would update 2xcurent price. And what is most important how could i return this field to my spreadsheet?

    Well I would be extremely gratefull for help and im working on some ideas also, if its too much hassle for your team its ok i will figure something !

    Thank you for your time.

  • Profile Image
    JotForm Support

    Answered by Mike_T on February 28, 2014 at 02:29 PM

    You might consider using server side calculations with PHP for example, or client side calculations with Javascript. Form will save the information from inputs upon submission and show it on the form submissions spreadsheet. If you would like to share some code, please use some service like http://pastebin.com/.

    Thank you.

  • Profile Image

    Answered by cryptomain on February 28, 2014 at 05:03 PM

    Hello again,

    I have made some progress i have implemented some code so the price ticker is in javascript and the bitcoin amount field works when you enter some input .

    Maybe anyone has some ideas on how to connect the ticker (#ticker) and field input (#input_9) and make the (#result) update? Thank you all for any useful inputs.

    (#input_9) has a random number 15 just to check that it works.

    Fiddle: http://jsfiddle.net/LH4r7/6/

  • Profile Image
    JotForm Support

    Answered by EltonCris on February 28, 2014 at 06:08 PM

    @cryptomain 

    Try this one: http://jsfiddle.net/LH4r7/7/

    Let us know if this isn't what you want to achieve.

    Regards!

  • Profile Image

    Answered by cryptomain on March 01, 2014 at 02:13 AM

    Thank you this is exacly what i need ! I will implement and test everyting if it does return the value to spreadsheet thank you again for your time. 

  • Profile Image

    Answered by cryptomain on March 06, 2014 at 04:26 PM

    Hello again,

    i have modified a bit the script so it would populate one of the fields of the form but the problem is it doenst  pass the result  to the spreadsheet after the submision. Is it possible at all with jotforms?

    Script:http://jsfiddle.net/LH4r7/10/

  • Profile Image
    JotForm Support

    Answered by EltonCris on March 06, 2014 at 05:18 PM

    @cryptomain

    That's because your form is different and no longer matches your modified form source code. http://www.jotformeu.com/form/40473885210352. Please make sure the field names on your modified form source code matches the field names on your form from Jotform, otherwise the field data will not be submitted.

    Since this is a different issue, may we request you to open a new thread about this so we can assist you better.

    Thanks!