NetTalk Central

Author Topic: Multi-select drop list  (Read 3884 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Multi-select drop list
« on: January 05, 2018, 07:28:14 AM »
Bruce,

Back in 2012 you posted this code to help with getting multiple selected items from a drop list:

if MAI:AutoResponseText = ';|;multiple;|;'
    n = p_web.GetPicture('MAI:AutoResponseText')
    MAI:AutoResponseText = ''
    loop x = 1 to n
      MAI:AutoResponseText = clip(MAI:AutoResponseText) & ',' & p_web.GetValue('MAI:AutoResponseText' & x)
    end
  end 

This works very well but when returning to the form later, the drop list does not have any items "pre-selected".  We need a way to automatically set the selected items in a drop list. 

In the above code you show,  p_web.GetValue('MAI:AutoResponseText' & x).  As an example, I wonder if something like, p_web.SetValue('MAI:AutoResponseText3', 'Item3Text') would allow us to set/select the third item in the drop list.  If so, we can then open a form with a drop list that has items pre-selected.  What do you think?  Will the code p_web.SetValue('MAI:AutoResponseText3', 'Item3Text') accomplish this?  I have tried but no success.  Perhaps it won't actually work or I tried the wrong embeds?

Thanks,

Jeff King
« Last Edit: January 05, 2018, 08:11:06 AM by jking »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Multi-select drop list
« Reply #1 on: January 08, 2018, 10:51:52 PM »
Hi Jeff,

It's been a long time since I did the Multi-Select stuff, and I don't think I have an example to hand. Perhaps the fastest way to get a complete answer to this is if you make a small example (perhaps mod a shipping example) to show where you are. ie with the multi-select working on the "save" but not on the "Change".
then I can see your file structure there and show how best to prime the select.

>> I wonder if something like, p_web.SetValue('MAI:AutoResponseText3', 'Item3Text') would allow us to set/select the third item in the drop list.

nope, sorry, that would not be the way to do it.

cheers
Bruce