Focal Point
[SOLVED] Hide the Calendar Text Box AND Calendar Icon

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9657006695

January 07, 2011, 10:56 PM
Doug
[SOLVED] Hide the Calendar Text Box AND Calendar Icon
Please download the code from here (* See note below) and run it in WebFOCUS to see that it does not hide the calendar icon along with the calendar text box. I need it to hide both when the function executes.

Here's some snippets from the above mentioned code
//Begin function HideCalendar_onclick
function HideCalendar_onclick(ctrl) {
document.getElementById("calendar1").style.visibility = "hidden";
}
//End function HideCalendar_onclick

...

<INPUT id=radio1_3 tabIndex=3 onclick=HideCalendar_onclick(this) value="Hide Calendar"...


So, can someone show me how to hide the calendar icon along with the calendar text box?

NOTE: "Save target as" then run it in WebFOCUS, otherwise you won't see what I mean (no calendar icon is displayed unless it's run in WebFOCUS)

Thanks in advance,
Doug

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




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
January 08, 2011, 06:21 AM
Tony A
Doug,

Here is some JS that I have used to do exactly this before. Note that it hits every calendar control and not a single one, but it should give you the idea on how to achieve what you need.

T

function RemoveCalIcons() {
// Well, not actually remove them, just empty the inner HTML code so they don't get displayed :)
  objCal = document.getElementsByTagName("INPUT");
  for (i=0;i<objCal.length;i++) {
    objCalicon = document.getElementById(objCal[i].name+"_img");
    if (objCalicon) {
      objCalicon.innerHTML = "";
    }
  }
}




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 
January 08, 2011, 09:38 AM
Doug
Thanks Tony, I'll check it out this afternoon (That would be evening to you on the other side of the pond) and post the new code.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
January 08, 2011, 10:59 AM
Tony A
Doug,

I really should have downloaded and read your code first - it uses ibirls3 and not ibirls2 which is what was prevalent when I used the code I supplied above.

I'll check ibirls3 and see if there is a way or you could just enclose the calendar control in a <div> and change the display attribute - which is, quite honestly, the easier way of doing it?

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 
January 08, 2011, 11:02 AM
Tony A
Doug,

Check for a PM from me containing the code using a div to hide and show.

T
January 10, 2011, 12:24 AM
Gokul Raj
i've used the following JS.
 var imageArray = document.getElementsByTagName("img");
 var imageArray_len = imageArray.length;
 for (var i=0; i < imageArray_len; i++) {
 if(imageArray[i].id == "") {
  imageArray[i].style.display = "NONE";
  break;
 }
 }  

and it worked.
i've ID attribute for all the images i use in HTML page.
The only IMG tag without the ID attribute is this calender. So it'll be hidden.


-Gokul,
WebFOCUS 769, 773, Windows XP, 7.
January 10, 2011, 03:14 PM
Doug
Thanks for all the insight which I used to come up with a solution which was easily implemented using the GUI (after understanding your insight and remembering what Ed Nowacki mentioned while at Ford Motor).

What I did was to add the calendars controls and the associated labels in to a "panel" then, programatically thru the associated functions, made the panel either visible or hidden. The other controls were controlled the same way.

NOW: Wink

Thanks Again.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206