NetTalk Central

Author Topic: Multi-select drop  (Read 3491 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Multi-select drop
« on: August 20, 2023, 04:32:54 PM »
Hi everyone,

     I have a drop with 13 entries in it.  I would like to use the multi-select feature and return the user selections to the target field.  The user is required to select 3 items from the drop and no more.  When I select the "Allow Multiple Selections" option on the template, the drop starts in the open state on the form.  I can select multiple items but nothing is returned except the following:  ;|;multiple;|;

I would expect it to return the selected items.  Any thoughts on hove to make this work?

Thanks,

Jeff King

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Multi-select drop
« Reply #1 on: August 20, 2023, 09:41:02 PM »
It's been a long time since I did one of those Jeff.
Perhaps make a small example app, or tweak one of the shipping examples to show the effect, and post that here.

cheers
Bruce

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Multi-select drop
« Reply #2 on: August 21, 2023, 03:05:10 PM »
Hi Bruce,

     I have attached a modified Web1 app.  I added a new field to the MailBoxes file called TestDrop.  I added this field to the Mailboxes form and the browse.  When the form opens, the new drop field is opened as well, which is not expected.  I select any number of items in the drop and click Save.  The browse now shows the contents of the new TestDrop field as ;|;multiple;|;

     I would expect the drop field to contain a list of the drop items I selected.  Thanks for looking into this.

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Multi-select drop
« Reply #3 on: August 21, 2023, 09:35:52 PM »
Thanks Jeff,

The docs are suspiciously silent on this setting, something I will need to remedy (but likely only after CIDC).

The short version is this;
p_web.GetValue('mai:testdrop')
returns
;|;multiple;|;

You can then query out the multiples;
p_web.GetValue('mai:testdrop1')
p_web.GetValue('mai:testdrop2')
p_web.GetValue('mai:testdrop3')
and so on.
when it's run out you'll get
;|;multiple;|;
again.

I recommend doing this in the ValidateRecord routine in the form.
What you actually _do_ with the values, I guess depends on what your data structure looks like. There's no built-in mapping of this to a single table field etc.

I'm not sure I'm 100% happy with this behavior (probably why it's not documented), but it's something I can look into in more depth on my return.

Cheers
Bruce

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Multi-select drop
« Reply #4 on: August 22, 2023, 06:23:41 AM »
Hi Bruce,

     Thanks for looking at this.  I found an entry here from January, 2018, where I asked pretty much the same question.  So, it has been an issue for some time. 

     My work around is to use Check Boxes for now.  This works well, but I do have quite a few of these fields and check boxes take up a lot of form real estate.  Individual multi-select drop fields would be better in this situation. 

     Part of the discussion in 2018 dealt with having the multi-select drop "remember" the selections the user selected.  Would be nice to have this built in as well.

Jeff

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Multi-select drop
« Reply #5 on: November 02, 2023, 03:31:35 PM »
Hi Bruce,

     Have you had any time to look into this issue with multi-select drop controls?  To summarize, I would like to select multiple items and have the drop control remember the items selected.  Instead of having the control set to ;|;multiple;|; when multiple items are selected, it should store them in the target field, separated by a comma, or some other separator character.  It would also be nice to have a limit property, for example, limit the user to 3, 4 or 5 selections from long drop lists.

Thanks,

Jeff