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.
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
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>
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.
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].
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 :
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.
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
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 :
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';
}
}
}
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
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 MattThis message has been edited. Last edited by: 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
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.
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
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, 2005
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, 2012