Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
setVisible functionality
Bhargav Coca
Here is my sample snippet on set visible for a checkbox . If the check box "AllDay" is selected then the Event start time and event end time should be invisible. Please let me know where i am going wrong.
Thank you
function init() {
IWEventRegistry.addFormHandler("onSaveValid", datevalid);
IWEventRegistry.addFormHandler("/AllDay","onItemChange", readonlysetting);
}
function readonlysetting(){
var alldayCheck = IWDatacapture.getItem("AllDay");
alert(alldayCheck);
var checkbox = alldayCheck.getValue();
alert(checkbox);
if(checkbox == 0){
IWDatacapture.getItem("/EventStartTime").setVisible(false);
//IWDatacapture.redraw();
IWDatacapture.getItem("/EventEndTime").setVisible(false);
IWDatacapture.redraw();
return true;
}
}
thanks again
Find more posts tagged with
Comments
Adam Stoller
IWEventRegistry.addFormHandler("/AllDay","onItemChange", readonlysetting);
I believe that should be
add
Item
Handler
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
jbonifaci
Also, one thing to note, unless the items you are trying to hide are in a row of their own, you can not hide them. In other words, you can't use rowcontinue=t and setVisible() together. Unless there this has been fixed in a SP that I am unaware of.
Bhargav Coca
thank you gentlemen, but i have this porblem, its working in one sense, but say i have changed my mind and changed the "AllDay" check box blank. It will not throw the times fields back for somereason, here is the entire code snippet.
Thank you in advance
function init() {
IWEventRegistry.addFormHandler("onSaveValid", datevalid);
IWEventRegistry.addItemHandler("/AllDay","onItemChange", readonlysetting);
}
function readonlysetting(){
var alldayCheck = IWDatacapture.getItem("/AllDay");
var checkbox = alldayCheck.getValue();
if(checkbox == 0){
IWDatacapture.getItem("/EventStartTime").setVisible(false);
IWDatacapture.getItem("/EventEndTime").setVisible(false);
IWDatacapture.redraw();
return true;
}
if(checkbox != 0){
IWDatacapture.getItem("/EventStartTime").setVisible(true);
IWDatacapture.getItem("/EventEndTime").setVisible(true);
IWDatacapture.redraw();
return true;
}
}
IWEventRegistry.addFormHandler("onFormInit", init);
Edited by lilleywhite on 06/15/05 01:27 PM (server time).
Adam Stoller
What version of TeamSite?
What is the value of checkbox - your code looked like:
...
var checkbox = alldayCheck.getValue();
// alert("somebox value"+somebox+"'");
if(checkbox == 0){
...
The commented out alert is referencing
some
box
as oppsed to
checkbox
- and it's checkbox that we want to know the value of when you select / unselect the item in question - because if that isn't giving you the information you're expecting, it will likely always be 0 or always be 1 and thus you don't get the toggling behavior you're looking for.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Bhargav Coca
Yes ghoti, You are right, but the checkbox itself is returning "0" or null, it not giving one. What ever we use, its not toggeling. Please help.
Thank you
yanSi
First of all, I believe the event handler readonlysetting() takes an Item as a parameter so you don't have to do IWDatacapture.getItem() within the handler. But that's not the cause of the problem.
In this line aren't you missing the slash before AllDay?
var alldayCheck = IWDatacapture.getItem("AllDay");
TS 6.5
Windows 2000 Server
Bhargav Coca
this doesn't toggel my settings. Here is the latest snippet.
function init() {
IWEventRegistry.addFormHandler("onSaveValid", datevalid);
IWEventRegistry.addItemHandler("/AllDay","onItemChange", readonlysetting);
}
function readonlysetting(){
var alldayCheck = IWDatacapture.getItem("/AllDay");
var checkbox = alldayCheck.getValue();
if(checkbox == 0){
IWDatacapture.getItem("/EventStartTime").setVisible(false);
IWDatacapture.getItem("/EventEndTime").setVisible(false);
IWDatacapture.redraw();
return true;
}
if(checkbox != 0){
IWDatacapture.getItem("/EventStartTime").setVisible(true);
IWDatacapture.getItem("/EventEndTime").setVisible(true);
IWDatacapture.redraw();
return true;
}
}
IWEventRegistry.addFormHandler("onFormInit", init);
Thank You
jbonifaci
Try something like this:
function readonlysetting(allDayCheckBox)
{
if (allDayCheckBox.getValue() == '0')
{
alert('checked');
}
else
{
alert('unchecked');
}
}
Let me know if you have any questions.
~Jeff
Bhargav Coca
Now it is working the which was kicking was " == '0' " .
now i have fixed it
thank you so much
jbonifaci
One other thing you should note from my code above is that the item object is passed into the onItemChange function, there is no need for you to do a getItem at the beginning of your function.
Bhargav Coca
Thank you, I have tried that too, but even if i specify the variable inside the function it works for me, i have not complete implemented what you have posted, but a little change of it. thank you again