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

Display fields in vf page when i click the button on vf page


I have reuirement like this...
I have a button on vf page.If i click the button the page will display input fields/text on the page. Other than button also if we can achive please give suggestions. Please help...

Thank you. 
Hi Madhu,

you can achieve your functionality using Javascript. see below example for your requirement.

Visualforce Page:
<apex:page id="myPage">
        function showTextbox(){           
            document.getElementById('{!$Component.myfrm:txtInput}').style.display = "block";
            return false;
    <apex:form id="myfrm">
        <apex:commandButton value="show Textbox" onclick="return showTextbox();"/>
        <apex:inputText id="txtInput" style="display:none;"/>

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
Email :-
My Blog:-