function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
krishnagkrishnag 

input checkbox

hi,

can anybody help me in making a input checkbox hidden in a visualforce page. 

Best Answer chosen by Admin (Salesforce Developers) 
krishnagkrishnag

got the answer in the tag

 

<apex:inputcheckbox style="visibility:hidden" />

All Answers

krishnagkrishnag

got the answer in the tag

 

<apex:inputcheckbox style="visibility:hidden" />

This was selected as the best answer
yvk431yvk431

yeah we can do it in another way too.

 

<apex:inputCheckbox id="chk" value ="checkbox"/>

<script>

document.getElementById(page:form:section:chk).visibility = false;

</script>

aballardaballard

If you are going to use document.getElementById to access a vf component, you should use $Component to get the appropriate generted id, instead of hard-coding the generated id.  That way it won't break every time you make a change to the page or salesforce makes a change to the generated html. 

 

Somethng like:

 

<apex:inputCheckbox id="chk" value ="checkbox"/>

<script>

document.getElementById({!$component.chk}).visibility = false;

</script>

 

ForstaForsta

Using the style=hidden helped me with checking a hidden checkbox on save of a custom form. Thanks very much for this post.