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] Date validation and stop processing

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Date validation and stop processing
 Login/Join
 
Gold member
posted
I’m using App Studio – HTML Composer with GUI. Within my page I have two calendar controls and a submit button. My goal is to perform a date validation and then stop processing in the event of a validation error. Using JavaScript I was able to do the date validation and throw an alert, but the form is still processing. Is there a way to prevent the submission of the form? I tried using ‘return false’ but that didn’t work. I have a few workarounds I can do, such as using JavaScript to submit the reports instead of the GUI, or I could hide the reports on a date validation error, but hopefully there is an easier way. Thanks!

This message has been edited. Last edited by: Joel Elscott,


WebFOCUS 8.2.03
z/OS
 
Posts: 66 | Registered: May 20, 2013Report This Post
Master
posted Hide Post
function form1Submit_onclick(event) {
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;

    if (dates_are_okay) {
       ...
    } else {
        // Dates are bad
        event.stopImmediatePropagation();
        return;
    }

}


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Member
posted Hide Post
Yes it can be done.
Write a function named eg. onValidate()

function onValidate()
{
if(your validation is true)
{
return(0); //it will redirect to run the procedure
}
else
{
return(2); //it will stops the report execution
}
}

This function should be called in the Tasks & Animations by creating a new Requests/Actions => "Javascript Call", Target Type => JavaScript Function, Function Name => onValidate

Followed by this request your procedure should be added next in Requests/Actions.

Thanks
Subbu


WebFOCUS 8.6
Windows, All Outputs
 
Posts: 9 | Registered: September 25, 2014Report This Post
Gold member
posted Hide Post
@subbu_088 - this worked perfectly! Thank you! This is the first time I've seen "return(2)" being used, but that's exactly what I needed.

@Squatch - Thank you for the suggestion, but unfortunately I couldn't get event.stopImmediatePropagation to work correctly. It stopped the JavaScript from processing, but then I couldn't get it restarted again when I fixed the date and resubmitted the form. Using Firebug I see that stopImmediatePropagation was an unknown function.


WebFOCUS 8.2.03
z/OS
 
Posts: 66 | Registered: May 20, 2013Report This Post
Master
posted Hide Post
quote:

@Squatch - Thank you for the suggestion, but unfortunately I couldn't get event.stopImmediatePropagation to work correctly. It stopped the JavaScript from processing, but then I couldn't get it restarted again when I fixed the date and resubmitted the form. Using Firebug I see that stopImmediatePropagation was an unknown function.

It will be unknown if you don't have "event" declared in your function:

function form1Submit_onclick(event) {

Actually, it doesn't have to be "event"... it could be "e" or whatever else you want to call it. You just need to declare something so JavaScript can fill it with data and functions related to whatever the user clicked on.

So if you declare it as "e" in your function, you would call it like this:

e.stopImmediatePropagation();

You already have another solution, so I'm posting this in case anyone else wants to try it. It works fine for me.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Gold member
posted Hide Post
@Squatch - Thanks again, the solution you mentioned did fix the unknown function error I was receiving. However it still won't let resubmit the form/submit button after I correct the date. It's like it stops everything on the page I can't do anything after I punch in a bad date. I do have another solution though, so I will definitely keep this in mind for in the future.


WebFOCUS 8.2.03
z/OS
 
Posts: 66 | Registered: May 20, 2013Report This Post
Master
posted Hide Post
quote:
Originally posted by Joel Elscott:
However it still won't let resubmit the form/submit button after I correct the date.

Try stopPropagation() instead of stopImmediatePropagation().


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     [SOLVED] Date validation and stop processing

Copyright © 1996-2020 Information Builders