› Forums › Autocomplete › Timing issue: Autocomplete vs. Cascade
- This topic has 4 replies, 2 voices, and was last updated 3 years, 11 months ago by
Alexander Bautz.
-
AuthorPosts
-
-
October 14, 2019 at 15:18 #27330
BenR
ParticipantAlexander,
I have a nearly working solution, with one last step failing…
I have a two field Cascade, Tier-1: LOB, Tier-2: SubLOB. This is working fine.
I also have Autocomplete, that upon selection, populates (setFields) both fields of the above Cascade, LOB and SubLOB – and this is where the problem lies. The Tier-1 LOB successfully populates every time, but the Tier-2 SubLOB does not. However, if I perform the Autocomplete a second time – the Tier-2 SubLOB is successfully populated.
I think this is a subtle timing issue… It appears to me that the Tier-2 SubLOB field is not ready to receive the data from Autocomplete until Cascade sees the value in Tier-1 LOB. I’ve tried to turn off all options in Cascade to hopefully allow it to run faster (turned off Hide, Autofill, and Clear), but with no success.
Here are the steps I take to fill the form with Autocomplete:
- From NewForm, I see that Cascade fields are shrunk in size as they are not yet populated (see image Step-1 below)
- Use Autocomplete, make Autocomplete selection – this will populate Tier-1 LOB field, but not Tier-2 SubLOB field (see image Step-2 below)
- Reperform Autocomplete – this time, Tier-2 SubLOB field is populated (see image Step-3 below)
I realize that Autocomplete and Cascade may not be intended to used together, but is there a work-around possible to accomplish my objective?
As always, I appreciate your support and efforts!
R’grds – Ben.
Reference:
Version informationDFFS Loader: v2
DFFS frontend: 4.4.4.10 – September 20, 2019
DFFS frontend CSS: 4.51 / 4.51
Autocomplete: 1.6.37 – September 04, 2019
Cascading dropdowns: 3.7.30 – July 21, 2019
jQuery: 1.12.4
Lookup: 1.1.17 – July 21, 2019
Resource management: 2.4.5 – August 29, 2019
SPJS-Utility: 1.337 – September 04, 2019
vLookup: 2.2.138 – September 04, 2019Attachments:
-
October 15, 2019 at 07:56 #27367
Alexander Bautz
KeymasterThis is happening because when you set the first level casc it does a query to fetch the next level, but if you try setting both at the same time your second level casc will not find a valid option for the value you are trying to set.
This might need some more custom code to work, but have a look at this newly added feature (you must update to v3.7.31 / DFFS v4.4.4.13 to use it): https://spjsblog.com/dffs/dffs-plugins/spjs-cascading-dropdowns/#Callback_function_when_select_is_filled
See if you can use this somehow to make it work.
Alexander
-
October 15, 2019 at 16:07 #27371
BenR
ParticipantAlexander,
Yes – I believe your suggested Callback function will do the trick… However, I do need additional guidance.
I have created an additional field, TemporarySubLOB, to capture the AutoComplete Tier-2:SubLOB value via setFields. When the Tier-2:SubLOB field is ready, I would like to move the value of TemporarySubLOB to it.
// Set value to Cascade to address timing of Tier-2 (SubLOB) function spjs_casc_ready(id, readyFIN, index) { var config = spjs.casc.data[id]; var filterValue = getFieldValue(config.thisListFields[(index - 1) > - 1 ? (index - 1) : index]); // Add your custom code here - like this example if (readyFIN === "SubLOB") { setFieldValue("SubLOB", "TemporarySubLOB"); } };
Do I just add the suggested function to Custom JS, or do I have to invoke it from a Rule? If I invoke it from a Rule, what parameters do I pass? I don’t see a id or index value in the Cascade debug information.
As always, I really appreciate your support and efforts!
R’grds – Ben.
-
October 15, 2019 at 17:36 #27376
BenR
ParticipantAlexander,
Oh duh! Your suggestion took very little to get working – though my poor scripting skills slowed me down.
The solution as you suggested worked perfectly! Thank you so much!
R’grds – Ben.
-
October 15, 2019 at 19:06 #27381
Alexander Bautz
KeymasterI’m glad you got it working.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.