Focal Point
Just curious...

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6801071652

November 07, 2007, 11:22 AM
<Shane>
Just curious...
Is it possible to have the default selection on a dynamic multi-select listbox be generated by WebFOCUS after the listbox values have been populated?

Shane
November 07, 2007, 12:03 PM
Tony A
Shane,

Think about where the select box is - it is in your HTML file and not WebFOCUS. This should enable you to answer your own question Smiler

WebFOCUS might be being used to populate the listbox but the data is passed to the client browser where JavaScript takes over.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
November 07, 2007, 12:12 PM
<Shane>
Tony,

Thanks for the reply. However when we try to use JavaScript, we found out that it executes before the WebFOCUS code does. Hence, we get javascript errors because there's no value in the listbox at runtime.

Shane
November 07, 2007, 12:30 PM
Tony A
Shane,

This is correct. If you use the HTML painter and therefore the IBI Javascript modules, then when your HTML page loads it runs a series of functions that populate the various controls on your page. It does this by retrieving an XML data file from WebFOCUS. This XML file is then parsed into pairs of data values that are used to poplate the list box, one for Value and one for Display.

Once these processes have been run then you should be able to run your own function to make the selections that you require.

In your HTML code you should have a section that looks like this -
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {
UpdateData();
// TODO: Add your event handler code here
}
//End function window_onload
</SCRIPT>

All you have to do is add your function calls after the TODO comment. Smiler

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
November 09, 2007, 11:15 PM
TexasStingray
I have not tried this but it is something I heard. If you call the html page and pass the name=value parameters on the URL it set the default values. Have not tried but and do not hold me to it. Please let us know what happend when you try it.




Scott

AlanB posted some javascript to do exactly what you want - it even takes care of the delay caused by WF populating the listbox dynamically.

Also if you read the whole of the linked thread, you'll see that there are plans to do this via WF in 764.

Cheers

Stu


WebFOCUS 8.2.03 (8.2.06 in testing)