Script Message on a form due to a large amount of conditions

  • townpark
    Asked on September 4, 2014 at 9:56 AM

    When I try to access my form, I am getting a pop up message that reads:

     

     

     

    A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

    Script: http://max.jotfor.ms/static/jotform.forms.js?3.2.3519:296

     

    I can either click on "Continue" or "Stop Script".

    I know that my form is very complex with many conditions and I didn't start noticing this message until after I had input a lot of conditions.  But is there a way to stop this message from appearing?

    Thanks,

    Alissa Kline

     

  • aadrinmusic
    Replied on September 4, 2014 at 10:32 AM

    Hi @townpark,

    I was trying to check your conditions on the Pool Pass Package and I think you need to rewrite your conditions. Trying to view them from here, I also experienced your problem.

    That window popping up is a Javascript program taking too long to complete and has timed out that's why it's displaying the message.

    I don't really know much right now why your conditions are what they are at the moment, from the screenshot I took below, as a programmer I believe your IF conditions are redundant.

    Script Message on a form due to a large amount of conditions Image 1 Screenshot 20

    Why not just make it simple like:

    IF Pool Pass Package Is Equal To "Adult Pass ($55)" --> then do something

    It's a one statement but it's very clear instruction. But again, you may have a purpose on why they were written the way they were so it would be appreciated if you can explain.

  • townpark
    Replied on September 4, 2014 at 11:03 AM

    Sure.  It is a bit complicated because of the pricing structure of the pool passes.  I basically created a condition that listed ALL the options of the pricing where only one of them was equal to that option to show the correct parts of the form.

    The reason it's complex is because users can mix and match the 1st 3 parts of the pricing between Adult, Child and Senior Passes, but if they choose more than 2 passes from this part of the pricing, their option should be a Family of THREE.

    Here is an example:

    If Pool Pass is not equal to ADULT, and

    If Pool Pass is not equal to CHILD, and

    If Pool Pass is not equal to SENIOR, and

    If Pool Pass is EQUAL to Family of Three, then

          SHOW 3 names and 3 ages and the rest of the form so that it can be completed.

     

    Reasoning behind listing ALL The pricing as NOT EQUAL to is so that they can't choose Family of THREE AND Family of FOUR at the same time.  Because Adult, Child and Senior are a mix and match, this was the best way I could come up with doing this where the user wouldn't make a mistake and choose more than one or the wrong combination.

    Hope this makes sense?

    Thanks,

    Alissa

  • aadrinmusic
    Replied on September 4, 2014 at 11:39 AM

    Hi Alissa,

    I guess the best way to do this is instead of having checkboxes for all your Family of XXX package, why not use radio buttons for them. In this way, you can only choose 1 and not multiple.

    Checkboxes are meant for multiple selections while radio buttons are meant for 1 selection only. So I can only choose one at a time for your Family of XXX.

    I hope this helps.

     

  • townpark
    Replied on September 4, 2014 at 11:47 AM

    Yes, I understand that, but then we will have to add the following options:

    1 Adult Pass

    1 Child Pass

    1 Senior Pass

    2 Adult Passes

    2 Child Passes

    2 Senior Passes

    1 Adult Pass and 1 Child Pass

    1 Adult Pass and 1 Senior Pass

    1 Child Pass and 1 Senior Pass

    as well as the six different family packages....

     

    I was trying to avoid a long list of options...

    Are you saying that there are no other options?

    Thanks,

    Alissa Kline

     

  • aadrinmusic
    Replied on September 4, 2014 at 12:22 PM

    Hi Alissa,

    The Adult, Child, and Senior passes will be checkboxes while the family packages will be radio boxes as I understand that only 1 family package can be selected. From there, it should be easier to implement conditions as the IF statements would surely be lessen.

    Let me know if I am make sense and understood your problem correctly or I need to take a closer look at your form. I would be happy to help.

    Cheers.

  • aadrinmusic
    Replied on September 4, 2014 at 12:25 PM

    Hi Alissa,

    The Adult, Child, and Senior passes will be checkboxes while the family packages will be radio boxes as I understand that only 1 family package can be selected. From there, it should be easier to implement conditions as the IF statements would surely be lessen.

    Let me know if I am make sense and understood your problem correctly or I need to take a closer look at your form. I would be happy to help.

    Cheers.

  • cmygsa
    Replied on September 4, 2014 at 12:38 PM

    How can you do that with a PayPal integration?  I didn't think you could mix up radio buttons with check boxes?

    Thanks,

    Alissa

  • aadrinmusic
    Replied on September 4, 2014 at 1:03 PM

    Yeah, I just realized Paypal Integration does not let you decide which button to use. Sorry about that.

    I will try to optimize your conditions instead to avoid the Javascript error. I'll let you know whenever I'm able to optimize your form.

    cheers!

  • cmygsa
    Replied on September 4, 2014 at 1:08 PM

    Great!  Thank you so much!  If there is something that I can do from my end, can you please let me know so that I can be a better user of the system?  Or if it's only from you end, then I really appreciate your help!

    Thanks,

    Alissa Kline

  • Mike_T Jotform Support
    Replied on September 4, 2014 at 2:58 PM

    You might also try a different way to calculate the payment total. This is possible to use calculations based on a user selection (using Text Boxes, Check Boxes, Radio Buttons and Drop Downs) to calculate the Total, and then forward it to the PayPal custom amount field.

    Please take a look at the following tutorials:

    How to pass a calculation to a payment field

    This way, you will have more control over the form ordering options and conditions. If you need any further assistance on this, please let us know.

  • townpark
    Replied on September 4, 2014 at 3:21 PM

    I have actually done that in another form.  But then wouldn't I be in the same situation with some options being a mix and other options not?  Would I have to make the conditions all over again?  Is there a widget that can allow a mix and match of options?

    Thanks again,

    Alissa

  • Mike_T Jotform Support
    Replied on September 4, 2014 at 4:59 PM

    I do not think that we have any widget for this, but you can have a different setup with the custom calculations.

    For example, you can use different fields for different 'product items', so it will lead you to simple conditions:

    If item1 selected
    Show fields for item1

    If item2 selected
    Show fields for item2

    If item3 selected
    show fields for item3

    Your current conditional setup is quite complicated, so it is hard to troubleshoot it in a fair amount of time.

    In case you need some example on the calculations topic, we can try to provide you with some sample.

  • townpark
    Replied on September 8, 2014 at 9:50 AM

    Thank you so much!  I worked on it this weekend and I got the form down to 26 conditions and it is running a lot faster with no Script error messages...

    Thanks again for you help!

    Alissa Kline

  • KadeJM
    Replied on September 8, 2014 at 11:06 AM

    Thanks for letting us know about that and we're glad to hear it's running better now. ;0)