Use js-based cascading dropdown

aksmith

Member
Hello (again):
I have many cascading dropdown city-county fields in a large form list - basic setup:
city field (db join from simple table of cities in Minnesota).
county (cascading dropdown of a counties table watching first field with city_id as foreign key, etc.).

They work great individually and in a smaller version of the form.
The challenge we face is performance in the full-scale form. It can include up to 21 of these coupled fields.
Any time a user submits, applies, copies etc., the mysql processing is extremely slow.
Running the submission in console (Firebug) shows the bottleneck lies in the many POST requests for the cd elements.
I have optimized tables and Fabrik according to recommendations.

Is it possible to use a javascript-based model instead?
The following snippet might be a model to use, although I would probably use a json file rather than embed the data inside the .js:
http://jsfiddle.net/mplungjan/65Q9L/

Thank you in advance for your help -
Cheers!
Alan
 
Not without some significant rewriting of the CDD element, which isn't something we're likely to do. The CDD element has taken many hundreds of hours coding over the years, and a re-write would be a nightmare. It is, to say the least, non trivial.

My CDD torture test form uses between half a dozen and a dozen join / CDD pairs. With a dozen it's not super fast but it's not horribly slow either. So it's worth checking that you have an index on the FK(s).

-- hugh
 
All FKs are indexed. A bit long (842 rows) - there are more cities in Minnesota than one might suspect. o_O
I'll look for other ways to consolidate that part of the data collection.

btw, I really appreciate the CDD element plugin - thanks again!
-Alan
 
Yeah, the CDD works well, but within a given "envelope". In this case, once you go beyond about a dozen CDD's on a page, it is going to start slowing down noticeably.

Just FYI, the main reason we went with an AJAX approach was that we need to support the "WHERE" clause filtering for CDD's, which can (and usually does) rely on knowing currently assigned element values on the form, and/or involves more complex dependent subqueries of other tables. So that can only be done by re-running the query on every change.

-- hugh
 
That's the downside of AJAXify. On the other hand, it makes for a much better UX.
Right now my solution is to disable the county field on the full-throated version of the form.
We can add the counties later into a summary list when compiling the data - the end-user just has to enter the city.

Seems like we could theoretically run some js-based cdd function in a bespoke action in the javascript element.
If you think that's worth while exploring, I'll play around with it after I review the form with the client (and send an invoice - :eek:).
-Alan
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top