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.
-
Can you post the code why which you made it disabled?– AshwaniCommented Aug 6, 2015 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>– NikithaCommented Aug 6, 2015 at 7:18
Add a comment
|
1 Answer
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;
}
}