Jump to content
  • 0

Multi-select cascading listbox in web form w/virtual fields


mdupras
 Share

Question

Hi all --

I have a web form that uses virtual fields to generate a search (passing parameters to results to separate datapage that appears on the same web page). Part of it is a listbox that cascades from a dropdown menu. I want to allow multi-select in the listbox, and have tried to use the JavaScript solution from Caspio: viewforum.php?f=14

The listbox field name is "Virtual3," and this is the code I'm trying -- I got the field name from looking at the source code of the direct URL to the datapage:

<SCRIPT LANGUAGE="JavaScript"> 

  var fieldName = "InsertRecordcbParamVirtual3";

   var x=document.getElementsByName(fieldName);
   x[0].multiple=true;

</SCRIPT>

"cbParamVirtual3" is listed as the field name, but the ID is different, and it changes every time I refresh the page. I've seen it a couple ways, i.e. "cbParamVirtual3_92BE1C377," "cbParamVirtual3_334E1C41A," etc.

I'm guessing this is a result of the cascade. However, even if I make this just a regular listbox, using the above code, it's not working.

Is there any way to make this work -- in particular, with the cascading option?

Thanks!

-- Mike

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi Mike,

First of all, a virtual field do not have "InsertRecord" part of its ID.

So it is usually called "cbParamVirtual#". Now if it is a cascading, you are right, every time the form refresh the element ID is different but the element Name remain the same so you can use

document.getElementsByName(fieldName)

Secondly, even if you can enable the multiselect option and pass it to the next form, the next form can receive it as a string containing multiple values separated by commas like "value1, value2, value3". Now if you are storing the vaules in the table like this, so you are ok but if not, the multi selection can not be implemented by passing parameters.

Best,

Bahar M.

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...
 Share

×
×
  • Create New...