You need to sign in to do that
Don't have an account?

Adding VF page
I'm sure I'm missing something here, so hopefully someone can help. I have a custom object that is used as a questionnaire and I'm developing a VF page because the length of each question is too long for a standard object label. Here's the VF page:
<apex:page standardController="Question__c" > <apex:form id="theForm"> <apex:outputPanel style="font-weight:bold;font-size:18pt;align:center;background-color:#CCFFCC;width=70%;"> Opportunity Questionnaire: </apex:outputPanel> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/> </apex:pageBlockButtons> <apex:outputPanel style="font-size:12pt;align:center;background-color:#99FF99;"><span style="font-size:16pt"> METRICS </apex:outputPanel> <apex:pageBlock > <apex:outputPanel style="font-size:12pt;align:center;background-color:#99FF99;;"> 1. WHAT METRICS/SUCCESS STORIES DO WE HAVE TO SUPPORT THIS SALES CAMPAIGN? </apex:outputPanel> <apex:pageBlockSection columns="1"> <apex:pageBlockSectionItem > <apex:inputField value="{!Question__c.Q1__c}" style="width:70%;"/> </apex:pageBlockSectionItem> <apex:pageBlockSection> </apex:pageBlock> </apex:pageBlock> </apex:form> </apex:page>
The question object is on a related list of the opportunity and I embedded this page into the page layout for the Question object. When I create a new Question, it looks great. But when I save it, it still looks like it's in Edit mode. I assume this is because I only have "inputField" statements, but how can I set this up so that it has "inputField" statements during edit and "outputField" styatements during display? Any clues on what I am doing wrong?
The page should be display save and cancel button When page is loaded. Set a variable flag = true in construction. So <apex:outputText rendered="{!flag}"/><apex:inputText rendered="{!NOT(flag)}"/>. you need to set this variable flag = false When the page has a edit button. <apex:outputText rendered="{!NOT(flag)}"/><apex:inputText rendered="{!flag}"/>
Hope this helps.
Thanks,
Samba
All Answers
You can add a boolean variable in Apex code. then add a propotype rendered to inputField and outputField.
If this post is helpfuls please throw a KuDos.
Thanks,
Samba
Thanks Samba. I was thinking of something along those lines, but what criteria woudl I use to determine if I should input or output? Is there some way to check if I'm in edit or display mode?
Thanks, Dave
The page should be display save and cancel button When page is loaded. Set a variable flag = true in construction. So <apex:outputText rendered="{!flag}"/><apex:inputText rendered="{!NOT(flag)}"/>. you need to set this variable flag = false When the page has a edit button. <apex:outputText rendered="{!NOT(flag)}"/><apex:inputText rendered="{!flag}"/>
Hope this helps.
Thanks,
Samba
Thanks! I haven't tried it yet, but this sure seems like it will do it!