• Hongjun
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies

I am working on a wizard kind of pages. There are two ages and if I return from the second page back to first page, all other values are displayed correctly except apex:inputfield that is checkbox field.

It will display correctly if using tag apex:inputCheckbox. But the label that is defined in the object custom field  will not be displayed.

Does anybody know why apex:inputfield is not displaying the value for checkbox? Thanks.

Just found a way to dynamically display custom button based on condition. Below example will show a custom button 'Problem input' if case reason is 'New problem' in Case page. Upon clicking the button, it will go to 'myProblemPage' page with case id.

 

<apex:page showHeader="false" sidebar="false" standardController="Case">
    <apex:pageBlock rendered="{!Case.Reason = 'New problem}">
      <apex:form >      
          <apex:commandButton value="Problem input" onclick="handleClick()"/>
      </apex:form>
      <script type="text/javascript">      
            function handleClick() {
              parent.location = '/apex/myProblemPage?id={!case.id}';
              parent.location.reload();
            }
      </script>   
    </apex:pageBlock>
</apex:page>

 

After the visual force page is created, it needs to be added into case pagelayout. Go to App Setup ->Customize->Cases->Page Layouts and edit existing page layout. In pagelayout editor, clicking on Visualforce pages Fields, then drag and drop the created visual force page to a section in the layout and save. Done.

The javascript in the page is setting and reloading the Case page to the returned VisualForce page. Otherwise if the button returns PageReference, it will only show in the small inline visualforce page area.

 

 

I am working on a wizard kind of pages. There are two ages and if I return from the second page back to first page, all other values are displayed correctly except apex:inputfield that is checkbox field.

It will display correctly if using tag apex:inputCheckbox. But the label that is defined in the object custom field  will not be displayed.

Does anybody know why apex:inputfield is not displaying the value for checkbox? Thanks.

I just found out the way you can implement dynamic redirect with Flows embedded in a VF page. Here is an example of the VF page and the controller which redirect the user to the detail page of a Lead created within the Flow.

 

VF Page:

<apex:page controller="myAutoInsuranceController" sidebar="false" showHeader="false" >
<flow:interview name="Auto_Insurance_Quote" interview="{!myAutoFlow}" finishLocation="{!nextPage}"/>
</apex:page>

 

Controller:

public class myAutoInsuranceController {

public Flow.Interview.Auto_Insurance_Quote myAutoFlow { get; set; }

public String getmyID() {
if (myAutoFlow==null) return '';
else return myAutoFlow.vaLeadID;
}

public PageReference getNextPage(){
PageReference p = new PageReference('/' + getmyID() );
p.setRedirect(true);
return p;
}

}