Jump to content
  • 0

Listbox problem


Rapid

Question

Hi,

I've managed to create a 'capture form' with a multiple selection listbox (as per the java solution), but when I create an 'update existing record' (using the java solution with "EditRecord****") I find that my listbox now has my previous selection(s) as an additional entry at the bottom of the listbox.

How do I get rid of this?

I am using custom selections.

Regards,

Rapid.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Hello,

When submitting info through a Web Form the listbox options concatenate separated by "," so in the table it is stored as option1,option2,...

In the Update form you need another Java Script to separate the options and highlight it in the listbox.

If you would like Caspio can develop the script for you, please fill out the Professional Services form at http://www.caspio.com/services/services.asp

Best,

Bahar M.

Link to comment
Share on other sites

  • 0

Hi,

This is not a standard feature of Capsio to have multi-select listboxes on Update form. The Java Script can be written by Caspio developers at a development fee. Please contact Caspio to get the code written because the script is not an easy or generic one that I can provide it for you.

Also a suggestion is to have checkboxes (Yes/No fields) rather than multi-select listbox but that works if there are few options not too many of them.

Best,

Bahar M.

Link to comment
Share on other sites

  • 0

I had considered using check boxes as a solution, but in my opinion this would look unprofessional in my application, and I'm a bit reserved about paying for a development fee in addition to the subscription fee. In my opinion this is a basic form function that should be supported - as I see that this requirement would not be isolated to my individual requirement, and I would see it as a necessary product development on your part (at some stage).

I'm a bit reserved about learning php / java or whatever - which is why I have chosen your product - as it provides a simple solution to most of my needs.

I would have thought that the mechanics behind the requirement would be relatively straight forward, and came up with the 'functional' solution in a few minutes (though it may be buggy / subject to interpretation)!

If somebody could 'translate' the following structure (or perhaps something similar) into usable code then it may be a solution:

Dim w

If [field is empty skip to end]

w(1)=1

count=1

x=1 to [length of field]

If [fieldposition](x)="," then count=count+1; w(count)=x+2

next x

*count now gives the amount of words in the field, w(count) gives the position of the next entry into the field

Dim W$

W$(1)=[field position] 0 to [field position] (w(1))-2

y=1 to count

W$(y)=[field position] w(y) to [field position] (w(y+1))-2

next y

* W$(1) is now the first word or term, W$(2) is the second, and so on.......

For x=1 to count

get w$(x)

next x

I might have made a few errors in the 'structure', but hopefully someone will catch my drift and may be able to help.

Failing that I may look to learn php myself.

Link to comment
Share on other sites

  • 0

Hiya,

I went ahead and paid the professional service fee to have this done. For anyone else who is looking for this and comes upon this thread via Google or otherwise, below please find the code that was created. The field in question in this example was called BISAC_Major_Subjects.

Code:

<script>
 var o_list_els = new Array("EditRecordBISAC_Major_Subjects") ;
  var o_field_els = new Array("[@field:BISAC_Major_Subjects]") ;
 
 
  //enable multi-select options
  for (var i=0; i < o_list_els.length; i++) {
    document.getElementById(o_list_els[i]).multiple = true ;
  }
 
  function f_listbox(){
    for (var x = 0; x < o_list_els.length; x++){
      var v_field = o_field_els[x] ;
      var o_listbox = document.getElementById(o_list_els[x]) ;
      if (v_field.indexOf(",") > 0) {
    v_field = v_field.replace(/&/gi,'&') ;
       for (var i = 0; i < o_listbox.options.length; i++) {
         if (o_listbox[i].value == v_field) {
           o_listbox.remove(i);
           break;
         }
       }
     
       var o_value = v_field.split(", ");
       for (var j = 0; j < o_value.length; j++) {
         for (var i = 0; i < o_listbox.options.length; i++) {
           if (o_value[j] == o_listbox.options[i].value) {
             o_listbox.options[i].selected = true;
             break;
           }
         }
       }
      }
    }
  }
 
 window.onload = f_listbox ;
</script>
Link to comment
Share on other sites

  • 0

ok I tried that code, it did not work for me. I still see my selections bunched up at the inside bottom of the list box. Very dissapointing. There is also not a way to clear the selection nor delete the selections from the record.

 

Very dissapointing that Caspio has this limitation when it should be very common.

 

I realized that your original post is very old, it is amazing that today it is 2014 and still the problem is here.

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