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

    Set calculations to have a minimum

    Asked by biiainsurance on January 30, 2014 at 01:13 PM

    @Elton helped me with this originally on the calculations ...

    I was asked if the "Premium Due" field could display calculated rate or $350 whichever is greater ....  

    So far this thing is working like a champ, I finally feel like we are seeing light at the end :o)

    Thanks again 

    Page URL:
    http://biiainsurance.com/builders-risk-form/

    calculations thanks
  • Profile Image

    Answered by biiainsurance on January 30, 2014 at 02:09 PM

    Wondering ... I found this 

    variablename=(condition)?value1:value2 

    and this is the original script from Elton .... 

    //estimated value, premium due, authorize.net
    estivalue.onclick = estivalue.onchange = function(){
    predue.value = ((ratevalue.value * estivalue.value)/100).toFixed(2);
    authonet.value = predue.value;

    }

    How would I do the comparison ? similar to below ? 

    //estimated value, premium due, authorize.net

    estivalue.onclick = estivalue.onchange = function(){
    predue.value = ((ratevalue.value * estivalue.value)/100).toFixed(2);
    preduegreater.value = (predue.value>350)?"predue.value":"350";
    authonet.value = preduegreater.value;

    }

     

     

     

  • Profile Image
    JotForm Support

    Answered by KadeJM on January 30, 2014 at 03:55 PM

    I'm a bit confused as to what you are trying to change here now? I see the script Elton gave you but it looks like it was built to do the comparison for this already. Was it not working that well if at all or something? Or may I ask what is the problem that it's doing now that has you are trying to reconfigure more here?

    The VARNAME is the variable that holds the values of the entire string. The CONDITION is your function which computes and compares the named 2 VALUES in the programmed equasion to return an answer depending on the outcome of data that is gathered when entered. 

  • Profile Image

    Answered by biiainsurance on January 30, 2014 at 04:02 PM

    His script works perfectly ... What i am trying to do now is take the predue.value which is also the authonet.value and see if it is greater that 350. If greater than 350 use the value if less than 350 use the value of 350 ..

    Does tha make sense ? Sorry for the confusion ...

  • Profile Image
    JotForm Support Manager

    Answered by Jeanette on January 30, 2014 at 05:27 PM

    As this is a custom code provided by someone in the Support Staff, I'll pass onto Elton so he can follow up

  • Profile Image

    Answered by biiainsurance on January 30, 2014 at 05:33 PM

    Thank you !

  • Profile Image

    Answered by biiainsurance on January 30, 2014 at 09:22 PM

    I guess this would stem from this post that Elton helped me with 

    http://www.jotform.com/answers/317385-Adding-values-in-form-and-passing-to-authorize-net-total-field?entrymessage=10732640770

    I feel like I almost have the script working but not quite sure the disconnect.

    Orignial
    #########

    //estimated value, premium due, authorize.net
    estivalue.onclick = estivalue.onchange = function(){
     predue.value = ((ratevalue.value * estivalue.value)/100).toFixed(2);
     authonet.value = predue.value;


    Edited to set value to 350 or value, whichever is greater
    ######### 

    //estimated value, premium due, authorize.net
    estivalue.onclick = estivalue.onchange = function(){
     preduegreat.value = ((ratevalue.value * estivalue.value)/100).toFixed(2);
     predue.value = (preduegreat.value<350)?"350":"preduegreat.value";
     authonet.value = predue.value;
    }

     

  • Profile Image
    JotForm Support

    Answered by TitusN on January 30, 2014 at 10:45 PM

    Hello,

    I have looped in Elton, and he shall respond as soon as he is available.

    Thank you for your patience.

  • Profile Image
    JotForm Support

    Answered by EltonCris on January 31, 2014 at 12:19 AM

    @biiainsurance

    Your code is right, you just need to remove the .value on preduegreat since you are storing the value on this variable not on an element. There is also no need for double quotes on the number (350) and the variable (preduegreat) in the condition. =)

    Here's a working version. (I have bolded the corrected ones).

    estivalue.onclick = estivalue.onchange = function(){

      preduegreat = ((ratevalue.value * estivalue.value)/100).toFixed(2);

      predue.value = (preduegreat < 350) ? 350:preduegreat;

      authonet.value = predue.value;

    }

    Regards!

  • Profile Image
    JotForm Support

    Answered by EltonCris on January 31, 2014 at 12:24 AM

    You can also replace onchange event with onkeyup to auto-update the values when you releases a key (on the keyboard).

    estivalue.onclick = estivalue.onkeyup

  • Profile Image

    Answered by biiainsurance on January 31, 2014 at 10:59 AM

    @Elton Thank you so much !! Works like a charm :o) 

    Before starting this form I knew nothing about Javascript ... some of it is clicking and some of it I just dont get. You guys have been awesome !!

     

  • Profile Image
    JotForm Support Manager

    Answered by Jeanette on January 31, 2014 at 12:29 PM

    Thanks a lot for your feedback towards Elton, he is a very valuable member in our team

    Cheers!