Jump to content

Is There An Option For Multiple Choice Fields That Allows Multiple Answers?


Recommended Posts

Hello aam82,

 

When you submit multiple answers, they are stored in the field and they are separated by comma.

For example:

"Nebraska, Washington"

 

On the Search Page, on the Advanced tab for Listbox elements, there is the "Allow multi-select" checkbox with two options:

Match any (OR)

Match all (AND)

 

The second one is disabled, if "Equal" comparison type is selected on the Standard tab.

You can select "Contains" Comparison type, then both options are enabled.

 

If you want more complex logic, you can use Criteria, "Contains" Comparison type and Logic tab.

 

I hope, it helps.

Link to comment
Share on other sites

  • 1 month later...

Hi Jan-

 

I've created a multi-select listbox in a Submission form using Java Script code (similar to what you suggested above) and I've been trying to figure out how to make the match an "OR" operator, but I haven't had much luck.

 

As it says here, Submission forms don't have multi-select option as a standard feature, so then I'm not presented with a simple option for how the match works. Also, it doesn't look like I have a logic tab available in this instance. 

 

Do you have any suggestions for how to make it an OR relationship between these multiple selects?

 

[if it helps, from the user perspective, I'm using this in an "advance search" form for my database.]

 

 

Thank you!

 

DM  

Link to comment
Share on other sites

  • 1 year later...

Thsi is driving me crazy - Im not really a javascript programmer (Thats why i chose caspio)

 

Ive been trying to create a simple multi select listbox , all the code links you guys submitted go to unavailable links like below.  

I have a  simple text field in my db "AirHotelCars" ,

1)I added 1 script I found to the footer

2) What are the exact step-by-step settings for the db field "AirHotelCars"  field in "Configure fields"

* some people mentioned make it Hidden ,what are the exact  on load and exit settings for the "AirHotelCars" field?

3) I created a virtual field and modified the footer javascript.

* some people mentioned make it Hidden ,what are the exact  on load and exit settings for the Virtual1  field?

Its not working and Ive spennt 2 days trying to figure this out.

I cant believe Caspio does not have a simple solution for multiple select listboxes and check boxes.

Thats as basic as it gets.

Grrr

 

Any help would be appreciated !

 "

The page you requested does not exist

 

Link to comment
Share on other sites

STEP BY STEP

HOW-TO MULTIPLE SELECT CHOICES IN LISTBOX ON UPDATE , DETAILS OR UPDATE REPORTS PAGES.

------------------------------------------------------------------------------------------------------------------------------------------

 
  1. Make Changes in the script below

---------------------------------------------------------------------------

  1. Change  mydbfieldname  to whatever your database Field Name is

  2. Append “EditRecord” with whatever your database fieldname is

Example :  Change “EditRecordmydbfieldname” toEditRecordyourfieldname” in the script.

 

    B) Paste the modified code below in the HTML Footer Section (Click on “Source” )

------------------------------------------------------------------------------------------------------------------------------

Footer is available in the “Configure Details Page Fields”  Section in DataPage using the Caspio Bridge DataPage Wizard.

 

     C) Configure your Field / Element

------------------------------------------------

   Add your database field to the details page   (in my example its “mydbnamefield” )

  1. Change the element (mydbnamefield”  Form Element to Listbox (In standard section > General Options)

  2. Choose Custom Values in Source

  3. Enter your Custom Values . Example : Air, Hotel , Cars

  4. In Advanced Section , SELECT “on exit” : Pass field value as parameter

  5. Enter [@mydbnamefield] as value or whatever your database field name is.

Thats it ! Viola !

. Now you will be able to multiple select the values in the listbox on your page using  Control +Click

The Values will be stored in your database field name like this….  “Air,Hotel,Cars” as a string.

 
 
 
 

This script below can be used (“As-Is”)

 

SCRIPT FOR MULTIPLE SELECT CHOICES IN LISTBOX ON UPDATE , DETAILS OR UPDATE REPORTS PAGES.

-----------------------------------------------------------------------------------------------------------------------------------------------------

<script type="text/javascript">
var v_state = "[@field:mydbfieldname]" ;
var o_state = document.getElementById("EditRecordmydbfieldname") ;
o_state.multiple = true ;

function f_listbox() {
 if ( v_state.indexOf(",") > 0 ) {
  for (var i=0 ; i < o_state.options.length; i++ ) {
if(o_state[i].value == v_state) {
o_state.remove(i);
break ;
}
  }
  var o_st = v_state.split(", ") ;
  for (var j=0 ; j < o_st.length; j++) {
for (var i=0 ; i < o_state.options.length; i++ ) {
if(o_st[j]== o_state.options[i].value){
  o_state.options[i].selected = true ;
  break ;
}
}
  }
 }
}
 window.onload = f_listbox ;
</script>

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
Reply to this topic...

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