Conditional logic on form

  • upscalemktg
    Asked on January 18, 2019 at 1:08 PM

    Question: 

    I am creating a JotForm with custom javascript code. I downloaded the source code and created a new HTML file which I am hosting on our server, since your forms cannot be hosted on JotForm that way. The custom code works great and delivers the desired results back to the form (see attached screen shot 1). However, the conditional logic for calculating subtotal / price breaks does not want to update in real time, even though I had to add another field (# of postcards) for the customer to manually enter. How do I get that interactivity back? It works when I test it out on the JotForm site (minus the code). Pardon my ignorance, I am a lowly graphic designer and this is a whole new area for me. Thanks.

    Jotform Thread 1705276 Screenshot
  • BJoanna
    Replied on January 18, 2019 at 2:07 PM

    If I understood correctly, the conditional logic calculation is working fine on your standalone form, but it is not working on your embedded form? Did you re-embed your form after you added conditions to your form? Please note that the source codes that are currently embedded to your page are not automatically updated when you edit your form. You need to re-embed it after each change. Please re-embed your form and test it again. 

  • Randy
    Replied on January 18, 2019 at 2:58 PM

    Thanks. The conditional logic was in the form before it was published, there were no changes to it. After it was published, I copied the source code into a new HTML document and added the custom javascript code. It is hosted on our server, since I am not allowed to add to a JotForm hosted form. I was following the instructions I found on the forum. 

    Here is a link to the JotForm hosted version (minus custom code) --

    https://form.jotform.com/90097792120154

    The problem I am running into is now that the custom code works and delivers the desired result to # of Addresses field, when the user manually enters the amount into # of Postcards field it does not auto update the fields below as before.

  • Kevin Support Team Lead
    Replied on January 18, 2019 at 4:51 PM

    I have been testing your form and I can see the issue on your page, upon checking the console I can see the following errors: 

    1547848066screenshot 01 Screenshot 10

    The problem may be happening due to a script conflict between the code used on your page and the code used in the form. You may try using the following no conflict code: https://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/ 

    Also, in order to discard the form itself is failing, you may also try embedding the form's code without your custom code and see how it goes. 


  • upscalemktg
    Replied on January 18, 2019 at 5:38 PM

    Thanks Kevin:
    We have other forms embedded in our new website where there is conditional logic and it seems to work OK there. It is just this type of form where we need the custom code to grab address routes and # of addresses from the USPS database -- all conditional logic seems to die. Trying to figure out ways around this. 

  • Elton Support Team Lead
    Replied on January 18, 2019 at 8:49 PM

    Update your jQuery script with the code here https://pastebin.com/raw/VFhqqxV3 to fix the conflict.

    Demo: https://shots.jotform.com/elton/1705276.html


  • upscalemktg
    Replied on January 22, 2019 at 12:08 PM

    Hi Elton:

    That code fixed the jquery issue perfectly. Thanks so much.

    -- Randy