0

I have created visual force page it's read only page. when I click the button called modify(find below images) it's redirect to same page with editable. Is it possible to create? can you please tell me how can I do this? Please find the attached images.

enter image description here

  • Can you post the code why which you made it disabled? – Ashwani Aug 6 '15 at 7:14
  • @Ashwani thanks for your response. I am not able to post my whole code.<apex:pageblock title="Period 1" id="blockA"> <apex:outputLabel ><b>Upper Date</b></apex:outputLabel> <apex:selectList size="1" value="{!Period1Date}" disabled="true" > <apex:selectOption itemLabel="--None--" itemvalue=""></apex:selectOption> <apex:selectOption itemLabel="1" itemvalue="1"></apex:selectOption> – Nikitha Aug 6 '15 at 7:18
0

Here is a simple example how you can do this. As you can see you have to use condition disabled="{!enabled}" to disable/enable the fields. On button click you have to rerender the form with all fields enabled. Hope this will help.

VF Page

<apex:page controller="MyController">
    <apex:form id="theform"> 
         <apex:inputText value="{!blah}" disabled="{!enabled}"/>
         <apex:commandButton value="modify" action="{!modify}" rerender="theform"/>
    </apex:form>
</apex:page>

Controller

public Class MyController {
    public boolean enabled {
        get;
        set;
    }
    public String blah {
        get;
        set;
    }
    public MyController() {
        enabled = true;
    }
    public void modify() {
        enabled = false;
    }
}

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.