Autocomplete widget working slow

  • fabglobal
    Asked on March 17, 2015 at 11:24 AM

    Hello Jotform,

    I have an issue concerning the autocomplete widget. I rlly like it and use it alot. Almost in al my forms.

    But now when creating my most recent form, the autocomplete field started to run very slowly. Almost like i'm experiencing "lag". On iPads, its almost unworkable. This is the form i'm talking about. Field: Uw naam.

    Entries made in the field "Uw naam" completes 2 more fields (SAP Nr & Uw email) via rules. The Field "SAP Nr" completes the hidden field "SAPCheck" via rules and shows/hides textbox via rules. Could it be, that my form needs to check to many rules and thus cause the 'lag'?

    Any thoughts on this are much appreciated.

     

  • Carina
    Replied on March 17, 2015 at 1:04 PM

    Is this form embed on a website? If so please let us know the website's url.

    I checked the form and it has 479 conditions. Probably this is creating this lag. I created a clone and disabled the conditions:

    Autocomplete widget working slow Image 1 Screenshot 20

    I believe it is better now. You can test it here:

    http://form.jotformpro.com/form/50754687153967? 

    I will still investigate to see if there are alternatives.

    Let us know if we can assist you further.

     

  • fabglobal
    Replied on March 18, 2015 at 3:13 AM

    No, I did not embed this form.

    And yes, there seems to be less delay now with the clone, but without these rules I won't get far.

     

  • Ben
    Replied on March 18, 2015 at 11:01 AM

    I took a look at your jotform and you had 516 conditions at this time, which is even more than when my colleague Carina looked at your jotform.

    Please note that the JotForm Builder is intended to create forms, but it is not as optimized a if it would be if the form was built only for your website, so more conditions you add, less speed you will have - which is only depending on your browser.

    So if you have someone that would access the form with slower PCs, they would have a hard time completing it as it is.

    Looking at the conditions, I noticed that you have quite a few conditions where the fields were removed - these conditions must be fixed or removed or they will always cause slow down or even issues on the jotform:

    Autocomplete widget working slow Image 1 Screenshot 40

    Autocomplete widget working slow Image 2 Screenshot 51

    There were few others as well.

    These are a must to be removed.

    Now further looking at the conditions I noticed that there were a lot of them that could be combined into one - a bit more complex, but still one condition, which would allow for faster execution.

    Autocomplete widget working slow Image 3 Screenshot 62

    With If -> Then checks when done like you have above it means that our tool must do this:

    if 1 then action
    if 2 then action
    if 3 then action
    if 4 then action
    if 5 then action

    ....

    Even if the first was matched, it will still go over and check 2, 3, 4, 5, etc.

    Not sure if you are familiar with programming, but the same is going on here, so to fix this we would approach it as in programming by building it as:

    if 1 OR 2 OR 3 OR 4 OR 5 OR etc then action

    This will go in from one to the first number that it found the match and do the action, meaning that if the first (1) was matched, it would not check the others if true as well, it would just do it.

    Further optimization / refactoring steps in programming would be to see the most often used options and put them in front of others, so instead of 1,2,3,4,5 you could have 4,2,1,5,3 if that is the order people would use them - helping you squeeze out even more speed ;)

    If you are not sure about AND and OR statements in conditions please take a look at this thread: How to Find The OR operator in conditions?

    If you have any further questions, do let us know over this thread.

    Thank you.

  • fabglobal
    Replied on March 23, 2015 at 3:55 AM

    Thx for you insight Ben. I will combine as many rules as possible.

  • Ben
    Replied on March 23, 2015 at 9:08 AM

    Great. Do let us know if it is still slow after doing so or if you have any further questions and we would be happy to assist.

  • fabglobal
    Replied on March 24, 2015 at 4:04 AM

    I removed the conditions where the fields were removed. And combined the ones that could be combined. But there was no increase in speed. (The condition that I combined have no effect on the autofield that is running slow)

    If I could update 2 fields with 1 rule, the amouth of conditions could be halved. But this is not possible (for now) Like this:

    IF Uw Naam IS EQUAL TO "x" INSERT "y" INTO Uw Email

    IF Uw Naam IS EQUAL TO "x" INSERT "z" INTO SAP NR

    ==>

    IF Uw Naam IS EQUAL TO "x" INSERT "y" INTO Uw Email AND "z" INTO SAP Nr

     

    I'm going to do a test to see if the following could increase the speed. This wil halve the amouth of conditions affecting my slow autocomplete field.

    IF Uw Naam IS EQUAL TO "x" INSERT "y" INTO Uw Email

    IF Uw Naam IS EQUAL TO "x" INSERT "z" INTO SAP NR

    ==>

    IF Uw Naam IS EQUAL TO "x" INSERT "y" INTO SAP NR

    IF SAP NR IS EQUAL TO "y" INSERT "z" INTO Uw Email

  • Ben
    Replied on March 24, 2015 at 9:43 AM

    You will not be able to set the conditions to add value to different fields at the same time, so that would need to be as it is.

    Looking at the conditions, I see that almost all of them are related to the value in the AutoComplete Widget and there are still almost 500 of them (473), which is quite a lot.

    It would work much faster if you are using regular dropdown instead, but that would not allow anyone filling it out to type in it to find the value.

    Would it be possible to skip entering the number through conditions and have it with the text instead?

    For example, instead of:

    LAGHOUILI Abderrahim

    to be:

    LAGHOUILI Abderrahim [24134]

    This way you would see the number and the name and it should work much faster since conditions are not checking the value of it all the time.

    Would that be something that would work for you?