Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Setting value of ALL to a listbox in the javascript

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Setting value of ALL to a listbox in the javascript
 Login/Join
 
Silver Member
posted
I have an html page with a listbox on it. That listbox is dynamic and gets it’s value from a fex. I have the ALL option checked on it. So when the page runs, the box would have a list in it like this:

ALL
Doe, Jane
Ford, Paul
Smith, Tom

Essentially this is a listbox of leaders. When the user comes in, we want to default this list of leaders to whoever signs in. I wrote a fex that gets executed out of an edit box. It gets the user id and turns into the name and then passes it to the listbox of leaders. I do have the situation where someone other than an actual leader could sign in. Maybe a manager. In those cases, if there isn’t a leader found, my edit box should be blank. In that situation I want JS to pass the value to the listbox for the ALL. I’m sure I can figure out the IF structure for the JS, I just can’t figure out how to pass a variable to the listbox for the value of ALL:

leaderName2 = "FOC_ALL";
document.getElementById("leaderlist").value = leaderName2;

For leaderName2, I’ve tried “FOC_ALL”, “ALL”, “FOC_NONE” but none of this works. What do I set this variable to so I can set my leaderlist to ALL in the JS?

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8.1.04
Windows, All Outputs
 
Posts: 34 | Registered: July 02, 2014Report This Post
Master
posted Hide Post
I created an HTML page with a drop down listbox. I populated it with the static values of "Moe", "Larry" and "Curly". I made the drop down display text names the same as the values.

I then told App Studio to add a value for no selection, and changed the no selection text to read "ALL".

Using Chrome's debugging capability, I was able to see that the value for no selection is "FOC_NOSELECTION".

When I set the drop down listbox's value to "FOC_NOSELECTION", the ALL choice appears.

This is as far as I have tested it, please give that a try.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
My results were the same for a single-select regular listbox as well.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Virtuoso
posted Hide Post
Why not using:
IbComposer_setCurrentSelection('controlID', arrValues, bUpdateDependencies);

See IBI Help menu (use F1 when in DS or IA) for detail on how to use


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Master
posted Hide Post
quote:
Originally posted by MartinY:
Why not using:
IbComposer_setCurrentSelection('controlID', arrValues, bUpdateDependencies);

See IBI Help menu (use F1 when in DS or IA) for detail on how to use

No thanks, I prefer to program using non-proprietary techniques whenever possible.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
quote:
Originally posted by Squatch:
No thanks, I prefer to program using non-proprietary techniques whenever possible.


Squatch maybe you don't prefer IBI's solutions, but April might. Please don't be so dismissive to things that other people may need or want to take advantage of.

April,

You can set the index of the dropdown to 0 also. the ALL option is always the first value.

 document.getElementById([ID]).selectedindex=0; 


You will need to reset the rest of the drop downs though. So once you reset your leader list to 'ALL' then you will need to issue
 IbComposer_ResetDownChainControls('ctrl'); 



To be honest with you though, I would look at how you are identifying the user instead and if you can recognize that the person is not a manager first and not make a change to the drop down, that would be better.

Also, the 'ALL' option passes '_FOC_NULL' by default (FOC_NONE was the old default... I'm not sure when they changed it. Somewhere around 7.6 I think). Just for future reference.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Master
posted Hide Post
quote:
Originally posted by eric.woerle:
quote:
Originally posted by Squatch:
No thanks, I prefer to program using non-proprietary techniques whenever possible.


Squatch maybe you don't prefer IBI's solutions, but April might. Please don't be so dismissive to things that other people may need or want to take advantage of.

I never said April wouldn't. April is free to read this thread and decide how to proceed based on the information in it.

And it wasn't clear that the question wasn't intended for me. The question was "Why not use..." and I answered truthfully. I don't call that being "dismissive" at all.

You made assumptions that weren't true, then proceeded to lecture me on them. That's what is known as a "straw man" argument.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Silver Member
posted Hide Post
Thanks everyone for the replies. Everytime I've opened a ticket I've always been given new suggestions that really help a person without a lot of experience. Such a fantastic forum! I've taken all of the suggestions and tried to use them.

I tried to use:

IbComposer_setCurrentSelection('controlID', arrValues, bUpdateDependencies);

It does set my listbox to All but I get an script error that _FOC_NULL is undefined. So it's setting it but not quite liking it.

I thought the most promising was Eric's suggestion of this:

document.getElementById([ID]).selectedindex=0;

That does work like I want. I added my IF statement now it's setting to ALL when nothing is in the edit box but still setting the name if it's valid. Here is my final function that is performed upon load:

function runByLeaderName() {
leaderName = document.getElementById("edit5").value;


if (edit5.value > " ") {
document.getElementById("leaderlist").value = leaderName;
}
else {
document.getElementById("leaderlist").selectedindex=0;
}


OnExecute(null,"submit_button");


}

Eric, my only question is on this command:
IbComposer_ResetDownChainControls('ctrl');

I'm not issuing it anywhere and when I tried I got an error. So I'm thinking I don't need it?..

My page is now loading correctly and I'm able to change that listbox values along with other listbox values and things are working perfectly.


WebFOCUS 8.1.04
Windows, All Outputs
 
Posts: 34 | Registered: July 02, 2014Report This Post
Master
posted Hide Post
April, you only need it if you have chained your leadername drop down to other inputs. If you haven't done that, then you are correct, you don't need it. If LeaderName is a part of a chain, then I would ask what error your getting. Perhaps you have not identified the ctrl correctly. I think in your case it would need to be:
 IbComposer_ResetDownChainControls('leaderlist'); 


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Silver Member
posted Hide Post
Thanks for the explanation Eric. I do not have any chaining so this makes sense.


WebFOCUS 8.1.04
Windows, All Outputs
 
Posts: 34 | Registered: July 02, 2014Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Setting value of ALL to a listbox in the javascript

Copyright © 1996-2020 Information Builders