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

    How do we prevent $NaN in the PayPal On Purchase Total widget?

    Asked by kokaneepowerforms on December 09, 2012 at 04:28 PM

    When using this widget and setting it up with some optional items where youu have a checkbox for the item and a dropdown to select the quantity I notice that the On Total Widget immediately shows a $NaN when you select the checkbox but not a quantity.   Same behavior in Firefox or Chrome.   When you select a quantity then it goes away.

    It does get worse though if the user were to leave some of these items checked but no quantity and then the Total always remains $NaN.  I'll add anothe screnshot of that in the followup post.

    One  reason why I have a selection checkbox is so when we get the alert emails we can see that line item in the purchase form called out.   Is tehre a better way to do this?

     

     

    Page URL:
    http://www.kokaneepower.org/raffle

    Screenshot
  • Profile Image

    Answered by kokaneepowerforms on December 09, 2012 at 04:33 PM

    Looks like I can't add upload another screenshot but the more complex issue is when you take the example above than then try to purchase a Raffle ticket bundle by selecting the tick box and a quantity then the Total still does not update.

  • Profile Image
    JotForm Support

    Answered by abajan on December 09, 2012 at 05:32 PM

    Hi Kevin

    The solution is to remove Select in both products' selectors. Once a product's box is not checked, no amount for that product will be added to the total. Only insert numbers (higher than 0) in the Quantitiy selector.

    If you need further assistance with this, please let us know.


    Wayne

  • Profile Image

    Answered by kokaneepowerforms on December 09, 2012 at 06:41 PM

    Thanks Wayne... that seems to fix that problem.   

    One other item though is if the user clicks on quantity 2 for example and then unchecks the tick box for that item then the quantity remains at what it was previously without resetting to a default which I would like to be zero.  Not a huge deal but if you know of an easy way for it to default back that would be great.   The good news is the deselect of the tick box does remove the amount from the total which is the most important thing.

  • Profile Image
    JotForm Support

    Answered by abajan on December 09, 2012 at 07:15 PM

    There might be a JavaScript solution for this. If there is such a workaround, it would require embedding a copy of the form's full source in a web page. Let me give it some more thought, run some tests and get back to you.

  • Profile Image
    JotForm Support

    Answered by abajan on December 10, 2012 at 04:19 AM

    Hi again Kevin

    Here's a demo where the entire drop down becomes hidden if the relevant box is unchecked and vice versa. I was trying to find a way to hide just the number displayed in each drop down when its box was checked but was unable to do so. However, one of my colleagues may be able to come up with a solution.


    Wayne

  • Profile Image
    JotForm Support

    Answered by abajan on December 10, 2012 at 04:42 AM

    Kevin,

    I forgot to mention what to do if you want to apply my solution to your form:

    1. Add the following rule to the injected CSS:

    .form-product-item
    .form-sub-label-container {
    visibility: hidden;
    }

    2. Save the form and then copy of its full source

    3. Paste the code obtained from the wizard into the source of a web page

    4. Copy this code and insert it anywhere after the form's code, preferably right before the web page's closing body tag, just like in the source of the demo

    If you need clarification on anything, please let us know.


    Wayne