Focal Point
Repopulate Listbox on Button Click

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

October 27, 2011, 12:12 PM
pvparuc
Repopulate Listbox on Button Click
Hi All,

I have a List box which is updated with data from a fex and a button on a HTML page. I am trying to Refresh the List box everytime the Button is clicked.
Tried using populateDynamicCtrl(obj) but didnt work.

Is there any way this can be accomplished.

Thanks in Advance,
pvpar


Release: Webfocus 7.6.11
OS/Platform: Windows
Output: HTML, EXL2K
October 28, 2011, 08:37 AM
David Glick
There is a feature in 7702 that handles this. If you are at 7702, please review the documentation.

Thanks.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
October 28, 2011, 11:16 AM
MAdams1
Since you are not at 7702 ....

Try this


//Begin function form1Reset_onclick 
function form1Reset_onclick(ctrl) {
document.getElementById('comboBox1').selectedIndex = 0;
window.top.frames.report1.location.href='about:blank';     
}
//End function form1Reset_onclick


The document line will reset your list box
The window line will clear you output frame

Hope this helps out.

MA


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
October 28, 2011, 12:03 PM
Doug
How about adding the Refresh button in HTML Composer (If you do it this way the whole solution will be using standard WebFOCUS functionality)
October 28, 2011, 12:11 PM
MAdams1
I have found that when using the "Reset Button" it will reset the controls but not the report frame. And then sometimes when I add the code to clear the frame then it stops resetting the control until I add the code to reset that too.


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
October 28, 2011, 12:20 PM
Doug
That's not good (I know: tell me something that I don't already know, right?)
October 28, 2011, 12:28 PM
njsden
quote:
(If you do it this way the whole solution will be using standard WebFOCUS functionality)

Hmmm, where have I seen that line before ...



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
October 28, 2011, 02:26 PM
Doug
quote:
Hmmm, where have I seen that line before ...
I wonder where that was... Music
October 28, 2011, 03:58 PM
pvparuc
Thanks everyone for the replies..

MAdams1 I tried using the code you posted, it didn't work. I already have the reset button but want to remove that so that the user doesnt have to reset the listbox everytime he adds something.
Here's some background of what I am tring to do. I have a FOCUS database to which I am tring to add and remove records, say COUNTRY names. I provided a HTML page for this functionality which has two buttons one to add the COUNTRY name, a list box with a Delete Button to delete existing COUNTRIES. Theoretically the user should be able to enter the COUTNRY name in the text box and press ADD Button to add it to the Database and the List box is as updated to reflect the changes. Same is true with the Delete button.
Went through the documentation and the forum too,but couldn't find anything.
Is there a way this can be accomplished.

Thanks,
Pvparuc


Release: Webfocus 7.6.11
OS/Platform: Windows
Output: HTML, EXL2K
October 28, 2011, 04:33 PM
MAdams1
Do you have the text box and the list box chained?


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
October 28, 2011, 05:29 PM
pvparuc
No they are not chained.. the List box should change only when the button is pressed..


Release: Webfocus 7.6.11
OS/Platform: Windows
Output: HTML, EXL2K
November 07, 2011, 06:15 PM
pvparuc
any Ideas on how this issue can be resolved without using the refresh button ???


Release: Webfocus 7.6.11
OS/Platform: Windows
Output: HTML, EXL2K
November 09, 2011, 10:57 PM
John_Edwards
I did something similar about five years back and it was a relatively simple Ajax call to wfservlet. Intercept the returning result and use the innerHTML attribute on the listbox to set the new contents.

I realize that's kind of a drive-by recommendation with about zero detail, but as I recall I was worried going in but it turned out to be pretty straightforward. Ajax is really pretty easy once you figure out a couple of basic concepts.

Option 2 -- Flash the screen. The button push submits the page and it returns with the new contents in the listbox. Easy, functional, not super-pretty. Other materials on the screen may prohibit this happening.

Option 3 -- Use JavaScript to call a focexec into a hidden iframe. That is, hand-assemble a url line to make a call to wfservlet. When it arrives have javascript in the iframe grab the output lines from the returning report (i.e., the new contents for the listbox) and set them in the parent window's listbox via the innerHTML attribute. It's pretty basic, but you won't have to dig into an Ajax call and it will keep you out of HTML Composer's idiosyncrasies. This one is easy to do, easy to debug. Leave the iframe visible while you work, hide it when you're done. The result will function like an Ajax call without all the protocol.

Clear as mud?

J.

This message has been edited. Last edited by: John_Edwards,