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
hk7965hk7965 

Hide button in visualforce page dynamically

Hi ,

I have a requirement to hide a button on pageload based on the value of the field on the samepage which get value from a controller. I have written JS on window load but it is not executing. Any thoughts on how to achieve this? 


Regards
Mohan Krishna
Best Answer chosen by hk7965
Vinit_KumarVinit_Kumar
You should use rendered attribute of command button something like below :-

<apex:commandButton value="Cancel" immediate="true" action="{!Cancel}" rendered="true"/>
// you can also bind it with a boolean property inside your controller.

If this helps,please mark it as best answer to help others :)

All Answers

Ramu_SFDCRamu_SFDC
The below article might help

http://www.interactiveties.com/b_visualforce_dynamic_buttons.php
Vidhyasagaran MuralidharanVidhyasagaran Muralidharan
Use rendered attribute for the command button
Vinit_KumarVinit_Kumar
You should use rendered attribute of command button something like below :-

<apex:commandButton value="Cancel" immediate="true" action="{!Cancel}" rendered="true"/>
// you can also bind it with a boolean property inside your controller.

If this helps,please mark it as best answer to help others :)
This was selected as the best answer
hk7965hk7965
Thanks Vinit/Ramu. It worked. 
demo org 66demo org 66
create a button in visualforce and click on button data is downloaded in pdf