Slow loading lookup field

By: Joe Semones | Asked: 05/25/2024
ForumsCategory: General questionsSlow loading lookup field
Joe Semones asked 6 months ago
I have a form which does lookups using the same key - email address - to pull six fields from one table which has ~50 records. After I enter a valid email address takes over 10 seconds to fetch the data from the other table. This is purely OOB functionality - no enhancements on the backend. I saw and implemented a suggestion to modify the PHP.INI file to allow a larger max_input_vars, but that had no appreciable effect. While the form is doing the lookup, the Submit button is spinning. However, if the button is offscreen, the user may not realize anything is happening. I could shift the button up near the email field which the user inputs so they'll know something is happening. 1) Is this delay typical for out of the box FF lookups? 2) If it is, is there a way to change or duplicate the Submit button - a copy of it, perhaps? - to reflect the lookup is working until the fields are populated? When the user completes their input, they'll see the final Submit button at the bottom of the form. If there's a better key to use, I'm open to it. Not every user in the source table has a username, so we cannot take advantage of that using this form.
4 Answers
Victor Font answered 6 months ago
There's not a lot to go on here. What kind of lookup field are you using. Formidable has different types of lookup fields? What do you mean by "the other table"? Formidable stores all entry data, regardless of form, in a single table with one row per populated field. Please provide more details of your process and include visuals if you can.
Joe Semones replied 6 months ago

<p><p>Thanks for your reply, Victor. Sorry for the misuse of the terminology.  </p><p> </p><p>I have two forms relevant to this question:</p><p>1) Registrations has the ~50 records whose fields include a registrant's email address, first and last name, and other information about the registrant.</p><p>2) In the second form, the user enters their email address in a Single Line text Lookup field that searches in Registrations for their email address. Six other fields fetch last name, first name, club, etc, etc related to that email address from Registrations. It is after I enter the email address in the second form and press enter, the fetch to auto populate the name, club, etc fields begins (which takes >10 seconds).    </p><p> </p><p>I appreciate your help. Joe</p></p></p>

Joe Semones answered 6 months ago
Thanks for your reply, Victor. Sorry for the misuse of the terminology.   I have two forms relevant to this question: 1) Registrations form has ~50 records whose fields include a registrant's email address, first and last name, and other information about the registrant. 2) In the second form, the user enters their email address in a Single Line text Lookup field that searches in Registrations for their email address. Six other fields fetch last name, first name, club, etc, etc related to that email address from Registrations. It is after I enter the email address in the second form and press enter, the fetch to auto populate the name, club, etc fields begins (which takes >10 seconds).  Is there a way to optimize the process other than reducing the number of times the lookup is performed?    I appreciate your help.
Joe
Victor Font replied 6 months ago

You still haven't answered my question. "What kind of lookup field are you using?"

How are you retrieving the values of the six other fields?

Why are you forcing users to enter the email address? When a user is logged into WordPress, their WP User Object is available in memory, which means you don't have to look up anything. Formidable provides shortcodes that allow you populate default field values with user details without doing any lookups.

Your design and process is not making sense. Please describe your process and why you've decided to lookup values without using built-in functionality.

Rob LeVineRob LeVine answered 6 months ago
I don't know if that time delay is "normal" (though it would frustrate me if it took that long). The following may not be the answer you're looking for however, you could make an Ajax call to a PHP program that returns the registrant information given the ID and then you fill in the fields using jQuery. That way there's only a single call to the db per user selection. It would certainly be interesting to test the two solutions running side by side.
Rob LeVineRob LeVine replied 6 months ago

A thought in addition to Victor's question is something to try. Temporarily change your form so that only one field is automatically filled in, instead of 10 and see how that affects performance. Try it with 2, 5, 10, and see what happens.

Joe Semones replied 6 months ago

Thanks, Rob.
I am not a coder, yet, but I have a feeling I'll need to become one before long.
I definitely see the value in testing with a single lookup value to resolve, timing the result, and see if it's a function of the number of fields' values I need it to fetch.

Rob LeVineRob LeVine replied 6 months ago

Let me know if you decide to go this other, coding route. This is one of my specialties and when folks hire me to do such projects, I always leave them with a shared Google doc explicitly detailing my work so that they can do it themselves the next time.

Joe Semones answered 6 months ago
Victor,
Thank you for your reply and further questions.

I am requiring the users to enter their email because not all reunion registrants have WP user accounts. We're working on getting the group members to create accounts, but did not enforce it this year. I know this would be a non-issue if they already had accounts. 

As to your question "what kind of lookup field are you using?", I am using the only one I am aware of provided by FF, the Lookup Field from the Add Fields list. Are there others? See LookupField.png

I am retrieving the values of the other fields using the Advanced Default Value (Lookup), searching in the Reunion Registration => First Name, Last Name, etc. See the attached images of the form build screen. LookupSearchInReunionRegistrations.png

I understand this method is sub-optimal. My question, really, is whether, given the current constraints (people without user accounts) is this performance as good as it gets? 

Thanks.

Joe
Attachments
Victor Font replied 6 months ago

It shouldn't take 10-seconds to retrieve those fields especially with just 50-records in the DB. Something may be wrong with your server, but that's impossible to know without hands-on testing. I would follow what Rob suggests. Test with 1-field and if it still takes a long time, try jQuery/AJAX. It should make things much faster.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right