We have a requirement where the customer can sign and fill the form and submit.After submitting the form the form will be saved as a attachment and the form will be emailed to the Owner of the Account as a PDF. I have achieved all the above process. But I need two command buttons to achieve the whole process. In this case customer might get confused or there is a chance for their to miss any of the button , So I have an idea to avoid this, When the customer enter into the form they can see only one button called "Submit" after clicking the submit button the page should be reloaded with the other button called "Please Review and Confirm" then the submit button should be hidden. Then the user needs to click the button to complete the form. So can anyone please guide me on how to achieve this?

  • Hi Arun Use Disable Attribute in commandButton tag – Vineeth Jan 9 '14 at 13:08

These Help Your Scenarioenter image description here Visualforce page:

 <apex:page controller="Sample" sidebar="false">
    <apex:pagemessages />
    <apex:form >
        <apex:commandButton value="Disable" disabled="{!disabl}" action="{!dis}"/>

Apex Controller:

public class Sample
    public Boolean disabl {get;set;}

    public void dis()
        disabl = true;

 ![Here is The Output ][1]
  • Thank you for your code. Can we hide the button instead disable using this code? – Arun Jan 9 '14 at 14:00
  • Keep your Button in <apex:outpanel render={!boolean}> and then you can hide it ,,sure it wl work out – Vineeth Jan 10 '14 at 10:03

You can use apex:commandButton's either onclick or rendered attribute to set visibility of the button. First approach will hide the button on the client only, while second will not render the button at all:

The onclick approach:

<apex:commandButton action="{!someAction}" value="Hide On Click" onclick="this.style.display='none';"/>

The solution with rendered attribute would feature just an extension of Vineeth's approach:

<apex:outputPanel id="pnl1">
    <apex:commandButton value="Disable" action="{!dis}" rerender="pnl1" rendered="{!disabl}" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.