Jump to content
  • 0

Cascading Listbox Fails To List Multi-Selections From Parent


Farnsbarnes

Question

Hi All…

Joined today and my first question to the Forum (I'm a novice so please forgive me if I ask dumb things about coding)!   My web form contains some search fields and a pivot table, all on one page.  For searching I use a submission form with virtual fields to pass parameters to the Pivot table report.

 

Two of my virtual search fields are “Region†(listbox), and “Country†(cascading listbox with “Region†as the Parent), but I need to have ‘multi-select’ for BOTH listboxes.  Thanks to this Forum I’ve managed to get multi-select ‘sort of’ working, using JavaScript in the footer:

 

<SCRIPT LANGUAGE="JavaScript">

 /* "Note that  â€˜cbParamVirtual1’ = the ‘Region’ listbox  (ie Parent) */

 /* "                   ‘cbParamVirtual2 = the ‘Country’ cascading listbox. */

 

   var fieldName1 = "cbParamVirtual1";

   var fieldName2 = "cbParamVirtual2";

 

   var x1=document.getElementsByName(fieldName1);

   var x2=document.getElementsByName(fieldName2);

 

   x1[0].multiple=true;

   x2[0].multiple=true;

</script>

 

The problem:

If I select just one region in Parent listbox, I happily get all the countries associated with that region in the cascading listbox.  And I can go on to multi-select those countries. Perfect!

BUT, if I multi-select, say “N.America† AND  “Europeâ€, then my ‘Country’ cascading listbox just states “No options availableâ€.   What I want is for it to list all the countries in both , “N.America†+ “Europeâ€.   Somehow my multi-selections from the Parent just aren't being recognised.   (Needless to say, this all works seamlessly in a tabular report format).

 

I’d very much appreciate any help.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

How many regions and countries are you dealing with? What about virtual field checkboxes for each region, and each countries, and put them in Sections on your form, and use Rules to show/hide the Sections based on the checkbox values, and pass all checkbox values as params?

Link to comment
Share on other sites

  • 0

Thanks for your answer, and you make a good point.  I've got 12 regions and 30 countries, so I'll try and do what you suggest.

 

Thing is that I have other menu situations where I'd only be able to use listboxes due to the high number of options.  Are you saying that it's not possible to have properly functioning multi-selections in both a parent listbox and a cascading listbox in a submission form?

Link to comment
Share on other sites

  • 0

If I'm not mistaken, the cascading listbox Caspio feature is hard-coded to search a table for a string that matches the value of the Source field.

 

A multi-select script can be used to concatenate two strings for an INSERT, but the concatenated string will not produce a match in your table when the Caspio cascade feature looks for a match, because it looks for the whole string.

 

I was thinking that if you had very large lists, then you would have to build your own cascading script with all of your relevant db values hard-coded.

 

I'll also mention that I have a couple of dropdowns over 800 values, and they're kind of annoying. I find autocomplete text (contains) is preferable, though not useful here.

 

Maybe you can make your filtering more linear in general?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...