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]Resticting inputs

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED]Resticting inputs
 Login/Join
 
Guru
posted
I have an App Studio composer page with a submit button and 2 calendars. How do I prevent a report from being submitted if the dates in the calendars are more than 1 day apart?

Note: I know how to do this in dev studio but not App Studio.

Fernando

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


Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
 
Posts: 278 | Registered: October 10, 2006Report This Post
Master
posted Hide Post
This can be achieved using JavaScript form validation scripts.
 
Posts: 542 | Location: Dearborn, MI | Registered: June 03, 2009Report This Post
Master
posted Hide Post
Make your calendar controls read-only so the user can't hand-edit the date (Properties section).

Make your calendar date format MDYY in the Settings section, and check the "Send unformatted value" box. Your dates will now be sent to your FEX procedure as a "MMDDYYYY" string (This may not be what your FEX is expecting, but it is for my example. You will need to tweak the following JavaScript code if you try a different date format, because it expects to rearrange the "MMDDYYYY" string temporarily into "YYYYMMDD" format for elapsed day testing).

You will need to place this code into the submit button's "Click" event (Properties event settings):

//Begin function form1Submit_onclick
function form1Submit_onclick(event) {
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
// TODO: Add your event handler code here

    var date1 = IbComposer_getCurrentSelection("calendar1");
    var date2 = IbComposer_getCurrentSelection("calendar2");

    if (date1 == "" && date2 == "") {
        alert("Please select at least one date range");
        event.stopImmediatePropagation();
        return;
    }
    var bmdyy = IbComposer_getCurrentSelection("calendar1");
    var emdyy = IbComposer_getCurrentSelection("calendar2");
    if ((bmdyy != "" && emdyy == "") || (bmdyy == "" && emdyy != "")) {
        alert("Incomplete date range");
        event.stopImmediatePropagation();
        return;
    } else {
        var byymd = bmdyy.toString().substr(4,4) + bmdyy.toString().substr(0,4);
        var eyymd = emdyy.toString().substr(4,4) + emdyy.toString().substr(0,4);
        if (eyymd < byymd) {
            alert("Start date cannot be greater than end date");
            event.stopImmediatePropagation();
            return;
        } else {
            if (eyymd - byymd > 1) {
                alert("Dates cannot be more than 1 day apart");
                event.stopImmediatePropagation();
                return;
            }
        }
    }
}
//End function form1Submit_onclick


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
quote:
Make your calendar controls read-only so the user can't hand-edit the date (Properties section).

Brilliant !! Something new to learn every day. Smiler


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report 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]Resticting inputs

Copyright © 1996-2020 Information Builders