Normal Topic selecting multiple choices from a list (Read 563 times)
FSGROUP
Full Member
***
Offline


No personal text

Posts: 179
Location: Edmonton, Alberta, Canada
Joined: Jan 14th, 2004
selecting multiple choices from a list
Feb 10th, 2004 at 10:03pm
Print Post Print Post  
I've tried using a Keyword field with a List Box or Combo Box LE to select multiple hobbies, but I can only select one choice from the list. (Tried using Ctrl, Shift, Alt to select > 1, but no luck)

TIA,
  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: selecting multiple choices from a list
Reply #1 - Feb 10th, 2004 at 11:31pm
Print Post Print Post  
I do not think that comboBox is going to let you enter multiple entries.  By having comboBox, you want to limit the choice and avoid the mistake in entry in KeyWord field.  The following work-around might work for you but it involves one more LE.
KeyWordField is a text box keyword field
Combo is ComboBox text field


Combo:                         KeyWordField:


Programming in Combo:  On element Immediage Change

If KeyWordField = "" then
     {
           KeyWordField = Combo + ";"
     }
Else If KeyWordField <> "" then
     {

           if @in (KeyWordField, combo) < 1 then
           KeyWordField = KeyWordField + Combo + ";"
     }

=====
In Combo:   On Element Exit event

Clear (Combo)
Goto (fieldOfYourChoice)

=====

When choose the item in combo and press down arrow it will add that in the KeyWordField. It will not take the duplicate entry.  
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: selecting multiple choices from a list
Reply #2 - Feb 12th, 2004 at 1:17pm
Print Post Print Post  
Yes, you can have multiple entries in Keyword field (without adding any additional LE) from a list using Userselect command. It involves a little code. Let's say the Keyword Element is Hobbies

Hobbies:
Following Code goes in Hobbies LE

=============
On Element Entry Event

var vHobby as String = @UserSelect("Tennis,Golf,Polo")

if Hobbies = "" then
     Hobbies = vHobby

Else if Hobbies <> ""  and @in (Hobbies, vHobby) > 0 then
     
     {
     Hobbies = @Replfir (Hobbies, vHobby + ";", "")
     Hobbies = Hobbies + ";" + vHobby
     }

=============
On Element Immediate Change Event

Hobbies = Hobbies + @Userselect ("Tennis,Golf,Polo")

==============
On Element Exit Event

var vLine as string

VLine = Hobbies
If @Right (vLine, 1) = ";" then
     vLine = @Del (Vline, @len (vLine), 1)

VLine = @replace (vLine, ";", "; ")
vLine = @Replace (vLine, " ;", ";")

While @in (vLine, "  ") > 0
     {
           vLine = @replace (vLine, "  ", " ")
     }

Hobbies = vLine

After selecting first choice from the list, Key in ";", that will popup list again for next choice. Do not worry about formatting at this point. Element Exit event code will take care of that.

Element Immediate Change event code makes editing very difficult if not impossible. Everytime you try to change something, the list of choice will pop-up and make editing challenging.  Remember, <esc> key will temporarily get the list off and use mouse selecting the text to be deleted rather than try to delete it with the keyboard.

I hope this will help.
« Last Edit: Feb 12th, 2004 at 2:29pm by Bharat_Naik »  
Back to top
 
IP Logged