PDA

View Full Version : Problem with listbox


hschmid
06-10-2007, 07:52 AM
I have a page with two listboxes. The data gets loaded from text files. According how you chose in the upper listbox, you will see different options in the listbox below.

I want my users to click on the choices on the lower listbox and then they will get directed to the according page. So far, everything what i tried from what i have seen in this forum failed.

Please kindly have a look on the attached programme. What is wrong? How can I the user jump by clicking on an item in the second listbox two the respective page?

Thank you very much for all help. I am very much beginner level and I am completely clueless.

RizlaUK
06-10-2007, 10:09 AM
ok, you have your code set out wrong,

when useing a listbox its best done something like this

-- get the selected item
cSel = ListBox.GetSelected("City");
-- make sure that a item is selected
if cSel then
-- get the selected item text, now the text is held in the var cSelText
cSelText = ListBox.GetItemText("City", cSel[1]);
-- compair the text and jump to the right page
if cSelText == "LMS" then
Page.Jump("Learning Managemen Systems");
elseif cSelText == "Weblogs" then
Page.Jump("demo_application_page");
-- add more here in the format
-- elseif cSelText == "item" then
-- Page.Jump("item_page");
end
end

also, you must refer to the exact page name

heres your example with the above code in

hope that helps

hschmid
06-14-2007, 12:27 AM
Thank you very much for your efforts and spending time in repairing the bugs in my code! It works wonderful now and the whole project is now succesfully completed.