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
Madhu007Madhu007 

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

Hi,

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. 
hitesh90hitesh90
Hi Madhu,

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

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


Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
Email :- hiteshpatel.aspl@gmail.com
My Blog:- http://mrjavascript.blogspot.in/