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     DS HTML Composer: Calendar control icon

Read-Only Read-Only Topic
Go
Search
Notify
Tools
DS HTML Composer: Calendar control icon
 Login/Join
 
Expert
posted
Here's a more difficult question than my last one!

I'm using JavaScript to disable certain controls depending on which radio button was clicked on.

For Calendar controls, I am able to disable the text box but not the calendar image. It seems this image is placed on the page via IBI JavaScript, it does not appear in the HTML. How do I refer to this image?

This message has been edited. Last edited by: Francis Mariani,


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
If you add the javascript prompt('',document.documentElement.outerHTML), you can get the generated HTML, and just have a look at where the images are, and how they are represented.

This should only work in IE.

Below is some Quickie HTML that shows what you get.

<html>
 <head>
  <title> Show HTML </title>
 </head>

 <body>
  <input type=button onclick="prompt('',document.documentElement.outerHTML)" value='Show HTML'>
 </body>
</html>


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Waz,

Thanks for the tip.

Meanwhile I used Firefox and Firebug to inspect the element and I found this:

<a name="PDTSPEC_img" href="javascript: PDTSPEC_calendar.show()">
<img width="16" height="16" border="0" style="position: absolute; top: 36px; left: 345px; z-index: 10000;" alt="click to select a date using the calendar" src="http://192.168.28.43:8080/ibi_html/javaassist/ibi/html/maint/dynCalendar.gif">
</a>

PDTSPEC is my Calendar control. I used
  document.getElementsByName('PDTSPEC_img').disabled = true;
to disable this anchor, but, though I got no errors, this did not disable the pop-up calendar. Maybe I'll get more info with your method.

Thanks,


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
You may have to change the href to stop it.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
For name="PDTSPEC_img" , if I can change or disable the JS href="javascript: PDTSPEC_calendar.show() I could make it work...


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
I tried
  document.getElementsByName('PDTSPEC_img').href = 'javascript:void()';
with no luck.


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
I found this js function.
function disableEnableAnchor(obj, disable) {
    if(disable)
    {
        var href = obj.getAttribute("href");
        if(href && href != "" && href != null)
            obj.setAttribute('href_bak', href);

        obj.removeAttribute('href');        
   }
   else {
    var href_bak = obj.attributes['href_bak'].nodeValue;        
    obj.setAttribute('href', href_bak);
    }
}


It seems to work, tested in IE.

Make sure that your call to the function is disableEnableAnchor(document.getElementsByName('PDTSPEC_img')[0],true);.
Note the [0], as a getElementsByName will return an array.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
quote:
document.getElementsByName('PDTSPEC_img')

That returns an Array of elements (all the elements with that name), not a single element.

I'm also doubting whether this would work in Internet Explorer, as it tends to confuse the functions getElementsByName() and getElementsByTagName().

ISTM that this is a case of improperly generated HTML again: that name-attribute should have been a unique id-attribute, which you would have been able to reference with getElementById() [note the lack of a plural form to "Element" there].

Anyway, try using:
document.getElementsByName('PDTSPEC_img')[0].style.display = "none";


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
<MLerner>
posted
I worked with one of our support representatives on this exact question about a year ago. The customer asking was on 7.6.10, so this may have changed. Below is the solution we ended up providing. Note: We were not actually able to disable the image, we just made it's size 0. Perhaps changing the visibility would have been better, but for some reason I think that failed to work as I would have tried that first.

________________________________________________________________________________

This must be done in the custom onInitialUpdate() funtion. Several things must
be done to make the calendar nonfunctional/disabled:
The textbox for the calendar must be disabled.
Reduce the size of the calendar object to zero.

Here is an example for an HTML with a single calendar control created by
the HTML Layout Painter:

function onInitialUpdate()
{
document.getElementById("Calendar1").disabled=true;
document.getElementById("dynCalendar_layer_0").style.width=0;
document.getElementById("dynCalendar_layer_0").style.height=0;
document.getElementById("dynCalendar_layer_0").style.border=0;
}

Please note that dyncalendar_layer_# increments per calendar. So Calendar
2 would be dynCalendar_layer_1... etc... You can either write a FOR
loop to hit all of them, or you can put the lines in as many times as needed.
 
Report This Post
Expert
posted Hide Post
Matthew (and Waz)

Thanks for the code suggestions - I will give them a try.


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
Guru
posted Hide Post
Francis,

As you have found, you cannot disable the image of the calendar control. You should open a case requesting that as a new feature.

I can tell you that we have added this ability in release 8. If you open a case, we can look into porting it to a prior release.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
 
Posts: 315 | Registered: April 13, 2004Report This Post
Expert
posted Hide Post
If the generated code for the anchor and/or image tags had included id names, this would have been easier to solve.


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
You should still be able to do a getElementsByTagName, and sift through the INPUT types.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
Not so much, I'm afraid - the calendar control image is not an INPUT type.

Using an XPath expression ("//a[name='PDTSPEC_img']") would work too, once you get your hands on some functions that execute those browser independently - Internet Explorer just has to do that differently, as usual.

I do recall seeing some XPath functionality in the ibirls3.js, it's quite possible you can "abuse" some of those functions. Libraries like JQuery, Prototype or Dojo can do this for you too.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
Francis - I just had the same issue come up this week. There is a way to do this. Not sure if it's the right way. Below is what we I did.

In the Composer itself, do not set the property of hidden in the Layout section for the calender, leave it default.

 //Begin function window_onload
 
var valid;
var RadioSelection; 
 
function window_onload() {
 
UpdateData();
 
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
 
//Set the default radio button value which is 1
 
RadioSelection = document.forms["form1"].elements["radio1_0"].value;
 
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate() -1
var year = currentTime.getFullYear()
 
 
document.forms["form1"].calendar1.value = (month + "/" + day + "/" + year);
 
 
  //get all images on the page into array
 var images=document.getElementsByTagName("img");
 
 //get the number of images in array
 var numImages = images.length;
 
 //Loop through images and see if it is a dynCalendar
 for (i=1;i<numImages;i++){
 if (images[i].src.indexOf("dynCalendar.gif")>0)
 {
 //If it is, hide
 images[i].style.visibility                             = 'hidden';
 document.forms["form1"].calendar2.style.visibility     = 'hidden';
 label5.style.visibility                                = 'hidden'; 
 	}
  }
}
 
function VALUE_1_onclick(ctrl) {
 
   //Set the radio value for the radio button.	
   RadioSelection = document.forms["form1"].elements["radio1_0"].value;
 
//alert(document.forms["form1"].elements["radio1_0"].value);
//alert('VALUE_1_onclick - 1 clicked');
	
 
   document.forms["form1"].edit1.value                = '';
   document.forms["form1"].calendar2.value            = '';
 
   document.forms["form1"].edit1.style.visibility     = 'hidden';
   label1.style.visibility                            = 'hidden'; 
 
   document.forms["form1"].calendar2.style.visibility = 'hidden';
   label5.style.visibility                            = 'hidden'; 
 
  //get all images on the page into array
 var images=document.getElementsByTagName("img");
 
 //get the number of images in array
 var numImages = images.length;
 
 //Loop through images and see if it is a dynCalendar
 for (i=1;i<numImages;i++){
 if (images[i].src.indexOf("dynCalendar.gif")>0)
 {
 //If it is, hide
 images[i].style.visibility='hidden';
    }
  }
}
 
 
function VALUE_2_onclick(ctrl) {
 
   //Set the radio value for the radio button.	 
   RadioSelection = document.forms["form1"].elements["radio1_1"].value;;
   //alert(RadioSelection);
   //alert('VALUE_2_onclick - 2 clicked');
  
   document.forms["form1"].edit1.style.visibility     = 'visible';
   label1.style.visibility                            = 'visible'; 
   
   document.forms["form1"].calendar2.style.visibility = 'visible';
   label5.style.visibility                            = 'visible'; 
 
 //get all images on the page into array
 var images=document.getElementsByTagName("img");
 
 //get the number of images in array
 var numImages = images.length;
 
 //Loop through images and see if it is a dynCalendar
 for (i=1;i<numImages;i++){
 if (images[i].src.indexOf("dynCalendar.gif")>0)
 {
 //If it is, hide
 images[i].style.visibility='visible';
    }
  }
} 


WebFOCUS 8.1.05
 
Posts: 496 | Registered: January 04, 2008Report This Post
Expert
posted Hide Post
MattC, This looks really exciting - I'll give it a try later today. Thanks so much for sharing your code - a much quicker solution than opening a case to ask for a "New Feature Request".

This message has been edited. Last edited by: Francis Mariani,


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
Gold member
posted Hide Post
Thanks MattC.

I am looking into this type of code.

Its very usefull.


WebFOCUS 7.6.1
Windows, All Outputs
 
Posts: 50 | Location: Scun-thorpe,UK | Registered: November 14, 2012Report This Post
Guru
posted Hide Post
quote:
Originally posted by David Glick:

I can tell you that we have added this ability in release 8. If you open a case, we can look into porting it to a prior release.


David - I am revisiting this exact JS that I posted in this thread finding that some of my JS doesn’t function as expected in WF 8. That’s not my issue as I am correcting what does not work, but I am interested in this new feature in 8 to hide the calendar icon. Is there some new approach to follow?

I set the controls hidden in the control properties and this is the JS I use to show or hide based on the radio button, but I am not sure how to easily show/hide the icon in this new feature that is in WF 8

 //Begin function radio1_onclick
function radio1_onclick(ctrl) {
 
        var RadSel = IbComposer_getCurrentSelection('radio1');
 
      //alert (RadSel);
 
  if (RadSel==1)
     { 
      IbComposer_showHtmlElement('label1', false);    
      IbComposer_showHtmlElement('edit1', false); 
      IbComposer_showHtmlElement('label1', false);
      IbComposer_showHtmlElement('calendar2', false);
      IbComposer_showHtmlElement('label5', false);
     }
  if (RadSel==2)
     {
      IbComposer_showHtmlElement('label1', true);    
      IbComposer_showHtmlElement('edit1', true); 
      IbComposer_showHtmlElement('label1', true);
      IbComposer_showHtmlElement('calendar2', true);
      IbComposer_showHtmlElement('label5', true);
     }
 
}  

Thanks Matt

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


WebFOCUS 8.1.05
 
Posts: 496 | Registered: January 04, 2008Report This Post
Guru
posted Hide Post
MattC,

In Release 8, there is a "Read only" property for the calendar that makes the textbox section unable to be used, forcing use of the icon. This is the usual request we get since the icon enforces the range and the format of the date value needed by the report/chart.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
 
Posts: 315 | Registered: April 13, 2004Report This Post
Virtuoso
posted Hide Post
David --

Has the problem with dynamic date-validation ranges (Case 73322521) been corrected in 8.0?


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
I was hoping for a different answer. The "Read only" property may come in handy down the road. I was hoping for an "easy" button on hide/show the calendar image when hiding the control itself.


For now I just implemented some JS to take care of it.


WebFOCUS 8.1.05
 
Posts: 496 | Registered: January 04, 2008Report This Post
Guru
posted Hide Post
MattC,

You can set disabled and that will disable the entire thing, though I don't know why you would want to do that.

Jack,

That case is closed because the icon is the only part that honors the range. The text area is just a text input that allows anything to be typed.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
 
Posts: 315 | Registered: April 13, 2004Report This Post
Expert
posted Hide Post
Did you try something like this, after hiding the text and labels?
//Begin function HideCalendars
function HideCalendars(ctrl)
    {
 document.getElementById("calendar1").style.visibility = 'hidden';
 document.getElementById("calendar2").style.visibility = 'hidden';
	images = document.getElementsByTagName("img");
	numImages = images.length;
	//Loop through images and see if it is a dynCalendar
	for (i=0;i<numImages;++i) {
		if (images[i].src.indexOf("dynCalendar.gif") > 0) {
  			images[i].style.visibility = 'hidden';
		}
	}
    }
// End Function HideCalendars
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Guru
posted Hide Post
When doing a dynamic range with the calendar control in 7.7.03, the icon only appears in IE. Also, chaining does not work properly period. Not sure if the HF corrects this.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report 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     DS HTML Composer: Calendar control icon

Copyright © 1996-2020 Information Builders