Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
listbox scroll
msrich
Displaying a previously saved form, how can I get a multiselect listbox to scroll to show the first of those lines that were selected? Does FormAPI provide the means to do this?
Find more posts tagged with
Comments
Gregg Faus
No FormAPI support for that. This is a pretty uncommon thing to do, but I believe you can use set the "selected" property for an option element. Set it to true so the browser will scroll it into view.
Try getting a reference to the first selected item in FormAPI and then set the "selected" property. This would be the javascript equivalent on a normal form:
(document.formName.selectName.selectedIndex).selected = true;
msrich
Thanks. That makes sense. I'm a JavaScript novice, though, so I'm having some trouble with the particulars.
I'm not sure how to get the 'formName' for the dcr and the 'selectName' for the listbox in question. And if I can get these values, I'm not sure of the right syntax for the JavaScript statement. Do I need to assemble the pieces as individually quoted strings with intervening '.' characters?
msrich
Another thought:
Is what you suggested equivalent to the following? (This is within 'init' function in javascript called from datacapture.cfg.)
var selected_lines = IWDatacapture.getItem("/MyListBox").getValue();
IWDatacapture.getItem("/MyListBox").setValue(selected_lines);
This seems to run OK, leaving the listbox with the same selected lines it had before, but it does not put the first-selected line at the top of the listbox. The listbox remains scrolled with its first item at the top.
Is there a 'set_top' method somewhere?