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     [CLOSED]Add a function to the reset button?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED]Add a function to the reset button?
 Login/Join
 
Expert
posted
The issue is that the reset button resets everything except for combobox6 and textbox18 (AKA: the items) which are associated with a radio2.

The items are hidden by default and are controlled by radio2:
function window_onload() {
UpdateData();
  hideMeasure("hidden");

}
//End function window_onload

// Hides the Measure Sort selection
function hideMeasure(state)
{
             document.getElementById("combobox6").style.visibility = state;
             document.getElementById("text18").style.visibility = state;
}
//End function hideMeasure


//Begin function radio2_onclick
function radio2_onclick(ctrl) {
if (document.getElementById('radio2_0').checked==true)
                {
  hideMeasure("hidden");
                }
else if (document.getElementById('radio2_1').checked==false)
                {
  hideMeasure("visible");
                }
else if (document.getElementById('radio2_2').checked==false)
                {
  hideMeasure("visible");
                }
}
//End function radio2_onclick

The reset bottom is just the standard one that's dragged on to the canvas.
So, how do I invoke "function hideMeasure(state)" when the reset button is clicked?

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




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
This didn't work either...
//Begin function reset1_onclick
function reset1_onclick(ctrl) {
   document.getElementById("combobox6").style.visibility = hidden;
   document.getElementById("text18").style.visibility = hidden;}
//End function reset1_onclick
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Master
posted Hide Post
Just a guess here...

Try this:

//Begin function reset1_onclick
function reset1_onclick(ctrl) {
   setTimeout(function(){ hide_again() }, 100); //Try 200 if 100 doesn't work

   function hide_again() {
     document.getElementById("combobox6").style.visibility = hidden;
     document.getElementById("text18").style.visibility = hidden;
   }
}
//End function reset1_onclick


What might be happening is that your code is executing before the reset happens. You want it to happen after the reset is complete. The "setTimeout" will delay the execution of your code by 100 milliseconds, which hopefully is enough time to let the reset complete. If it doesn't work the first time, try 200 milliseconds or higher.

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


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Expert
posted Hide Post
Thanks Squatch, I'll try that. But, a quick Q&A first: Why would it make a difference as to when a control is hidden? My thought would be to hide it before the reset as the reset isn't doing anything with those "items"...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Master
posted Hide Post
Because your code executes as soon as the click event happens, but it takes time for the reset code to complete. JavaScript is "asynchronous," meaning more than one set of code can run at the same time.

So when the reset button is clicked, your two-line code gets executed along with the code that resets the controls. Since your code is small, it finishes before the reset code does, possibly overwriting the changes you are trying to make.

That's my theory, anyway. I know this can happen because I had to put in a 100 millisecond delay in a double listbox click event recently. I wanted to resort the lefthand side of the listbox when a user decides to put something back from the right side to the left. I found that my sort routine fired right away, did the sort, BUT... other code that moves the item from right to left had not finished. So the item never sorted, because my sort code ran before the item was there.

That might not be your issue, but it sounds familiar to me considering my experience with the double listbox.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
Okay, I just did a test and it looks like you're right... the reset doesn't seem to affect visibility, so that probably isn't the problem you are encountering.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Expert
posted Hide Post
I tried several variation of that, up to and including the following.

//Begin function reset1_onclick
function reset1_onclick(ctrl) 
{
   setTimeout(function(){ hide_again() }, 100); 
   function hide_again() 
	{
     document.getElementById("combobox6").style.visibility = hidden;
     document.getElementById("text18").style.visibility = hidden;
   }
}
//End function reset1_onclick
I'm not sure if the reset1_onclick function is invoked when clicking of reset1
//Begin function reset1_onclick
function reset1_onclick(ctrl) {
alert("Reset requested"); 
}
//End function reset1_onclick
If so I should see that alert... I've always thought that the "reset" buttons "acted on their own".
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Master
posted Hide Post
In my test, clicking the reset button fires the reset1_onclick function. I put an "alert" command in and the alert pops up when I click reset. You should see your alert. If not, you've got something weird going on.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
Are you sure your reset button is called "reset1"? Maybe you've now got a "reset2" button on your form so that's why nothing is happening?


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Expert
posted Hide Post
Yep, it's as much of "reset1" as it can be... What version of Dev Studio are you using? (you may want to add / update your signature)
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Master
posted Hide Post
I use App Studio 8.1.0.5.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report 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     [CLOSED]Add a function to the reset button?

Copyright © 1996-2020 Information Builders