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]How to prevent onClick() execution using AppStudio

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]How to prevent onClick() execution using AppStudio
 Login/Join
 
Virtuoso
posted
Hi,
Here a question for a newbie user of AppStudio : how can I prevent the execution of my report when the onClick() event is triggered and validation failed ?

Let's explain.

I have an HTML page that provide a bunch of controls to assign filters/parameters for a report, when I press the "Run" button, I want to apply some validations.
Up to there all works fine since I can have alerts telling me which field is invalid.

I'm applying js validation on field and all goes well and perform validation as it should be but the report is still launch even if one of the fields is invalid.

Here a sample of the onClick() event for the Run button that I want to implement:
function buttonRun_onclick(event) {
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;


    if (IsNumeric(GPMIN.value) == false)
    {
        alert("This is not a valid number");
        GPMIN.focus();
        return false;
    }
}


Within WF7 having a "return false;" in the onClick() event prevent the report to be launch.
How can I achieve the same result in WF8 using AppStudio ? Can't find the option to prevent execution.

And even an IBI consultant that I have here don't know how...

Thanks to help

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


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
Expert
posted Hide Post
I create a separate function that performs the validations and returns true or false.

//Begin function validateParams
function validateParams(ctrl)
{
    if (blah... blah...)
    {
        alert('blech... blech...');
        return false;
    }
    else
    {
        return true;
    }
}
//End function validateParams


In the onclick function, I do the following:

//Begin function btnRun_onclick
function btnRun_onclick(ctrl)
{
    // TODO: Add your event handler code here
    if (validateParams(this))
    {
        // run report
        OnExecute(ctrl);
    }
}
//End function btnRun_onclick


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Thanks Francis,

This is quit similar as I did but it doesn't work; the report is still launch even with an error.

I see the HTML passing and setting the good things. It find the error and set the variables accordingly, but the report is still executed.

If I remove the runButton associated task, nothing is executed when no error found.

It's sure that I'm missing something somewhere, but can't figure it out.


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
Expert
posted Hide Post
Martin, I thought this would work - regardless of which GUI was used to develop the page. I used Dev Studio, not App Studio - sorry about that.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Try the suggestion in this post:

[SOLVED] Date validation and stop processing


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Thanks Francis.

I've been able to make it work using the stopPropagation() function.


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
  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]How to prevent onClick() execution using AppStudio

Copyright © 1996-2020 Information Builders