Jump to content
  • 0

2 How-to questions: Multiple Checkbox and fixed page width


ajdadulla

Question

Hi, there!

1. How do I create multiple checkboxes?

Instead of Multiple selection from a Listbox, I want to present it as checkboxes instead. Is this possible from a Javascript?

2. How do I set a fixed page width so that the page is not too wide when the browser is maximized.

I know this is possible when the page is embedded into a cell or a table, but I only would like to post a link to the data page on our website.

Let me know if you need more information to answer my questions. Thanks a bunch!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hello,

Using standard Caspio checkboxes, you need to have one field for each checkbox holding a value of Yes or No.

If you would like to have only one field to store all values separated by comma (same as multiple selection listbox), this is not a standard feature at Caspio and requires Java Script programming as you have mentioned too.

The script is not a simple one, as one function is needed to get the values and concatenate them and store in the actual field. And another script is needed to read the values from table and break them into multiple checkboxes for display and edit purpose.

If you would like Caspio to write the code for you, you can submit a Professional Service request at http://www.caspio.com/services/services.asp

In regards to your second question, you can set a fixed width in styles:

Edit the style, enable Advanced options so CSS tab displays in the settings screen,

Forms/Details >> Layout

In the class called .cbFormTable add the following line:

width: 400px;

Best,

Bahar M.

Link to comment
Share on other sites

  • 0

In my case, I was OK with using a dropdown menu for data entry, as the selection would only be temporary or permanent. (The item could never be both). But in the search page, a user may want to search for either or both, and checkboxes would be much more user friendly.

In Configure Search Fields select the DataPage Element, and make it a listbox with comparison type of equal. Make the source a lookup and select the table. Create a new HTML Block under that Element, and paste the following:

<label>Permanent</label>
<input type="checkbox" id="checkbox0" onClick="changeSelect('0')">
<label>Temporary</label>
<input type="checkbox" id="checkbox1" onClick="changeSelect('1')">

You can easily add to this if your input listbox contained something like "semi-permanent".

Below the HTML Block, create a new Footer, and paste the following:

<script type="text/javascript">
  var pushVal = document.getElementById('Value5_1');
  pushVal.style.display = "none";
  function changeSelect(value) {
    var box0State = document.getElementById('checkbox0').checked;
    var box1State = document.getElementById('checkbox1').checked;
    if (value == 0 && box0State == true || value == 1 && box1State == true) {
      pushVal[value].selected = true;
    }else{
      pushVal[value].selected = false;
    }
  }
</script>

This is pretty easy to extend as well. If you added a checkbox with id of 'checkbox2' in the HTML, just write a new var box2State line, add " || value == 2 && box2State == true" to the if statement and you're done.

Note in the above code that the id of my listbox is Value5_1, which I'm hiding from the user and also populating its values through the checkbox handlers. You will need to change that id to the id Caspio Bridge assigns to your particular element.

Maybe this will keep someone out there from a few hours of head scratching.

Link to comment
Share on other sites

  • 0

It seems I'm not the only one seeking multiple selection checkboxes on this site. It also seems like the reasons they don't exist are based on being able to charge a little more to the end user. Not sure if I like that.

Having said that, I found some script in here to create multiple checkboxes for a search form. I tried to incorporate it but to no avail.

I have a lookup_table with 29 selections. I would like to use checkboxes arranged neatly on the page via html (maybe 5 across, evenly spaced). I would like to draw the labels and content from the lookup_table allowing the user to make multiple selections at once. (maybe sent as a comma separated list to the table, example 'ET, HDCP, MT,' etc.

It sure would be easy if multiple checkboxes were possible in Caspio .. (hint, hint) but since they aren't, I need some help getting it to work.

Thanks....

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