Select to view content in your preferred language

Autocomplete field won't display dropdown options when javascript referenced

1865
4
Jump to solution
10-25-2023 07:06 PM
AKitch
by
Regular Contributor

I'm having an issue where my autocomplete field dropdown list will not display when I have a javascript function referenced. In my form I have javascript which auto fills a field with the previous repeat's value. This process works fine in Survey123 Connect 3.16. However, I've moved to Connect 3.18 and I get this behaviour (I get the same behaviour in Connect 3.19 beta). When I remove the pulldata request the dropdown list works fine.

I notice that the only way I can get the drop list to work is to start typing and select a random option that is listed; when I delete this entry I am then able to see all dropdown options.

Is there a known issue or have I missed something? I've changed the javascript functions to very basic ops and still get the same behaviour. It seems the presence of the pulldata triggers the behaviour.

I've attached my test form  which shows this behaviour. It's a subset of a much larger survey. The javascript functions I use are:

function getPreviousShotNumber(sampled_fish_repeat){
 
if (sampled_fish_repeat.length > 1) {
return sampled_fish_repeat[sampled_fish_repeat.length - 2].shot_no_sample;
}
}
 
 
function getPreviousCustomSpeciesSamp(sampled_fish_repeat, pos){
 
if (sampled_fish_repeat.length > 1 && pos != 1) {
if(!sampled_fish_repeat[pos - 1].species_samp){
return sampled_fish_repeat[sampled_fish_repeat.length - 2].species_samp_custom;
}
}
}
 
 
 
function getPreviousRadioSpeciesSamp(sampled_fish_repeat, pos){
 
if (sampled_fish_repeat.length > 1 && pos != 1) {
if(!sampled_fish_repeat[pos - 1].species_samp_custom){
return sampled_fish_repeat[sampled_fish_repeat.length - 2].species_samp;
}
}
}

 

 

 

Cheers,

 

1 Solution

Accepted Solutions
MarceloRigoto
Emerging Contributor

Hello @AKitch, I believe that if you use this you can solve your problem:

Calculation mode: manual

 

for reference: Survey123 Tricks of the Trade: Calculation modes - Esri Community

 

View solution in original post

0 Kudos
4 Replies
MarceloRigoto
Emerging Contributor

Hello @AKitch, I believe that if you use this you can solve your problem:

Calculation mode: manual

 

for reference: Survey123 Tricks of the Trade: Calculation modes - Esri Community

 

0 Kudos
AKitch
by
Regular Contributor

Thanks MarceloRigoto

That has almost fixed the problem but not quite! 'calculationMode=auto' helps a lot. However, I still have to start entering a value to get a dropdown list shown. If I try to get the dropdown list before entering anything then nothing shows. I've uploaded the edited XLSForm which shows the behaviour.

0 Kudos
MaureenSpiessl
Occasional Contributor

Good morning,

 

I have a slightly different issue but along the same lines. I have a dropdown or type the first initial of our workers and it is supposed to pull up our field inspector names. It works on Survey 123 connect but will not work in experience builder or the desktop. 

In connect I have the following. 

MaureenSpiessl_0-1701434861545.png

Any thoughts?

Thank you in advance. 

 

0 Kudos
AKitch
by
Regular Contributor

Hi MaureenSpiessl

The problem I had was largely soved by the solution MarceloRigoto suggested (calculationMode=Manual) and updating the XLSForm template under the Tools in Survery123 Connect. Not sure if these will solve your problem though. Good Luck!

0 Kudos