Help with Combobox

Post Reply
dbrazoli
Posts: 67
Joined: Thu Dec 19, 2013 6:33 pm

Help with Combobox

Post by dbrazoli » Fri May 03, 2019 7:13 am

Hello, Jon. Are you all right?
I need a help with combobox. I will mount the items dynamically, and would like to capture the value of 'Key' as long as a value was selected. Would you help me ? It can be in php or jquery.
Thankful.
Daniel.

jomitech
Site Admin
Posts: 1964
Joined: Wed Oct 08, 2008 12:23 am

Re: Help with Combobox

Post by jomitech » Fri May 03, 2019 9:11 am

Combobox or JTComboBox? And how are you adding the items?
Jon

dbrazoli
Posts: 67
Joined: Thu Dec 19, 2013 6:33 pm

Re: Help with Combobox

Post by dbrazoli » Fri May 03, 2019 11:04 am

Jon, sorry, it's JTCombobox.
I'm feeding the JTCombobox via array (Key, value).
Thankful.

jomitech
Site Admin
Posts: 1964
Joined: Wed Oct 08, 2008 12:23 am

Re: Help with Combobox

Post by jomitech » Mon May 06, 2019 5:16 pm

Can you show the code you're using to populate the JTComboBox, and also where are you trying to capture the value? In PHP or JavaScript?
Jon

dbrazoli
Posts: 67
Joined: Thu Dec 19, 2013 6:33 pm

Re: Help with Combobox

Post by dbrazoli » Tue May 07, 2019 1:32 pm

Jon, this is the first problem.
I can not feed items with pairs (key, value).
I can do this using the native combobox component, but I can not do it with the JTCombobox.
Following routine:
function Page1Create ($ sender, $ params)
{
$ listaop [0] = array ('Key' => '1001', 'Value' => 'Option 1');
$ listaop [1] = array ('Key' => '1002', 'Value' => 'Option 2');
$ listaop [2] = array ('Key' => '1003', 'Value' => 'Option 3');
$ listaop [3] = array ('Key' => '1004', 'Value' => 'Option 4');
$ listaop [4] = array ('Key' => '1005', 'Value' => 'Option 5');

$ this-> JTComboBox1-> Items = $ listaop;

}

Thanks.
Daniel.

jomitech
Site Admin
Posts: 1964
Joined: Wed Oct 08, 2008 12:23 am

Re: Help with Combobox

Post by jomitech » Wed May 08, 2019 6:09 pm

The problem is that you're using keys that look like numbers, so it's being treated as a numeric index, rather than a key/value pair. Can you change your keys to have at least one non-numeric character?
Jon

Post Reply