0

I have a toggle buton call Edite. When I click on the Edite it will change to save and enable me to edite all the fileds. When edit button turn in to save i have two save buttons. So i want to Hide one of my save button name (Id = c2. ).

   <apex:pageblockButtons >
      <apex:commandButton action="{!doToggleEditMode}" value="Edit" reRender="myPanel" rendered="{!NOT(bEditMode)}" id="c1" />
      <apex:commandButton action="{!doSave}" value="Save" reRender="myPanel" rendered="{!bEditMode}" />
      <apex:commandButton value="Save" action="{!save}" id="c2"/>
</apex:pageblockButtons>

I post this question yesterday and i got a answer saying

    <apex:commandButton action="{!doToggleEditMode}" value="Edit" reRender="myPanel" 
  rendered="{!NOT(bEditMode)}" id="c1"
  onclick="document.getElementById('{!$Component.c2}').style.display='none';return true;" />

This works,when i click on edit it will hide my save button but my toggle button does not work. It does not allow me to edit. Any body know why?

  • If I were you, I would try to attack it different way - have just one button and be able to recognize what behavior is expected from that button given current conditions. Having multiple buttons and hiding / showing them to me is a dirty way to do it - however I don't say it's not possible to get the effect as you want. – Maciek Simm Jul 8 '15 at 22:50
  • 1
    I see you asked a similar question in Hide a button on click. Please have a read of What should I do when someone answers my question? and – Daniel Ballinger Jul 8 '15 at 23:35

Your Answer

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

Browse other questions tagged or ask your own question.