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     Display dynamic date value in html prompt

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Display dynamic date value in html prompt
 Login/Join
 
Member
posted
Can html painter integrate an &ervariable to
display a default value for a date prompt in
html launch page ?
 
Posts: 3 | Registered: November 25, 2005Report This Post
Virtuoso
posted Hide Post
Couple of options: you can use a -HTMLFORM BEGIN/END in a fex (with your HTML page code in between and then any &variables you insert can become part of the launch page. This then becomes a .FEX instead of an .HTM, but it will work the same when you run it.
You can also use javascript to get a default value into a form control.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Member
posted Hide Post
Darin, thanx for the reply. I understand -htmlform begin/end and have used that technique, but I have had gui tool not open...I need to keep all within gui for client. I am js novice, can you forward sample js code ?
 
Posts: 3 | Registered: November 25, 2005Report This Post
Virtuoso
posted Hide Post
So am I - that's why I didn't post any code. Smiler
Here's something I snipped off the internet (googled javascript get current date). You should be able to take out the pieces you need and then display the variable today as the default value in your control.

 <SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!--  Author: www.cgiscript.net  -->

<!-- Begin

// Get today's current date.
var now = new Date();

// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

// Calculate four digit year.
function fourdigits(number)	{
	return (number < 1000) ? number + 1900 : number;
								}

// Join it all together
today =  days[now.getDay()] + ", " +
         months[now.getMonth()] + " " +
         date + ", " +
         (fourdigits(now.getYear())) ;

// Print out the data.
document.write(today);

//  End -->
</script>
 


As I said, I know very little JS. I'm sure someone has already done this so they may have an actual example.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Member
posted Hide Post
Will try...thank you.
 
Posts: 3 | Registered: November 25, 2005Report This Post
Expert
posted Hide Post
David,

I use a standard module that I reference in all my WF related HTML that presets a calendar control text box with a date. The date can be "fixed" by adding an attribute of "dateoffset" to give a date relative to the system execution date.
<script>// Version 1.0
// Written by : Anthony Alsford - EDATA Limited
// Purpose    : To populate all calendar controls on a form with an elementtype attribute
//              set to "editcalendar".


// This function is called on form loading and pulls a collection of calendar controls
// before calling the function to set the date value
    function PrepDates() {
      for (i=0;i<document.all.length;i++)
      {
        if (document.all(i).elementtype == "editcalendar")
          {
           this.displayElement = document.getElementById (document.all(i).id);
           SetDate(document.all(i).id);
          }
      }
    }

// This function is designed to set the date value according to an offset value contained
// within the input tag.
// The only parameter required is the elements id value.
    function SetDate(item) {
      this.displayElement = document.getElementById(item);
      var today = new Date();
      var offset = this.displayElement.getAttribute('dateoffset');
//alert(offset);
      today.setDate(today.getDate()-offset);
      var t_date = today.getDate();
      if (t_date<10) {t_date='0'+t_date};
      var t_mnth = today.getMonth()+1;
      if (t_mnth<10) {t_mnth='0'+t_mnth};
      var t_year = today.getFullYear();
      t_year = t_year - 2000 ;
      if (t_year<10) {t_year='0'+t_year};
      var end_date = t_date+"/"+t_mnth+"/"+t_year;
      this.displayElement.value = end_date;
    }
</script>

To include it just insert the code either via a-
<script src=filename.js></script>
or just include it within you HTML. Generally it does matter where you put the code, but as you would be calling this from your onload event you can place it inbetween the close body and close html tags.

To call it just add a line in the HTML withinin the onload script -
PrepDates();
Remember that JS is case sensitive.

Note: I do have a later version where it doesn't matter if you do not add a dateoffset attribute to your code, but I can't locate it at the moment (too many memory keys with stuff on - have to rationalise them sometime Wink)

Good luck

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report 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     Display dynamic date value in html prompt

Copyright © 1996-2020 Information Builders