1

I have a visualforce page

<apex:page controller="ActionFunctionDemoController" >  
    <flow:interview name="Calculator" rerender="ddff" />
    <apex:outputPanel id="ddff" />
    <apex:form >
        <apex:actionFunction name="action1" action="{!action1}" rerender="scriptPanel" />
    </apex:form>
    <apex:outputPanel id="scriptPanel">
        <script>
        var nextBtns = document.getElementsByClassName('FlowNextBtn');
        var j=0;
        for(j=0;j<nextBtns.length;j++) { 
            nextBtns[j].addEventListener('click',function(){
                console.log('--coming here--');
                action1();
            });           
        }
        var previousBtns = document.getElementsByClassName('FlowPreviousBtn');
        for(var j=0;j<previousBtns.length;j++) {
            previousBtns[j].addEventListener('click',function(){
                console.log('--coming here---');
            });
        }
        </script>
    </apex:outputPanel>
</apex:page>

and apex controller

public with sharing class ActionFunctionDemoController {
    public Pagereference action1() {
        return null;
    }
}

my flow definition is

<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <choices>
        <name>Excellent</name>
        <choiceText>Excellent</choiceText>
        <dataType>Number</dataType>
        <value>
            <numberValue>20.0</numberValue>
        </value>
    </choices>
    <choices>
        <name>Fair</name>
        <choiceText>Fair</choiceText>
        <dataType>Number</dataType>
        <value>
            <numberValue>10.0</numberValue>
        </value>
    </choices>
    <choices>
        <name>Good</name>
        <choiceText>Good</choiceText>
        <dataType>Number</dataType>
        <value>
            <numberValue>15.0</numberValue>
        </value>
    </choices>
    <choices>
        <name>Poor</name>
        <choiceText>Poor</choiceText>
        <dataType>Number</dataType>
        <value>
            <numberValue>5.0</numberValue>
        </value>
    </choices>
    <formulas>
        <name>TipAmount</name>
        <expression>{!Bill_Amount}*{!Quality_Of_Service}</expression>
        <scale>2</scale>
    </formulas>
    <formulas>
        <name>TotalBill</name>
        <expression>{!TipAmount}+{!Bill_Amount}</expression>
        <scale>2</scale>
    </formulas>
    <label>Calculator</label>
    <screens>
        <description>Capture bill amount and service quality</description>
        <name>Bill_Information</name>
        <label>Bill Information</label>
        <locationX>435</locationX>
        <locationY>152</locationY>
        <allowBack>true</allowBack>
        <allowFinish>true</allowFinish>
        <connector>
            <targetReference>Show_Tip_Summary</targetReference>
        </connector>
        <fields>
            <name>Bill_Amount</name>
            <dataType>Currency</dataType>
            <fieldText>Bill Amount</fieldText>
            <fieldType>InputField</fieldType>
            <isRequired>true</isRequired>
            <scale>2</scale>
        </fields>
        <fields>
            <name>Quality_Of_Service</name>
            <choiceReferences>Excellent</choiceReferences>
            <choiceReferences>Good</choiceReferences>
            <choiceReferences>Fair</choiceReferences>
            <choiceReferences>Poor</choiceReferences>
            <dataType>Number</dataType>
            <fieldText>Quality Of Service</fieldText>
            <fieldType>RadioButtons</fieldType>
            <isRequired>true</isRequired>
            <scale>2</scale>
        </fields>
    </screens>
    <screens>
        <description>Display tip amount</description>
        <name>Show_Tip_Summary</name>
        <label>Show Tip Summary</label>
        <locationX>789</locationX>
        <locationY>302</locationY>
        <allowBack>true</allowBack>
        <allowFinish>true</allowFinish>
        <fields>
            <name>TipSummary</name>
            <fieldText>You say the quality of service was {!Quality_Of_Service}, so you should leave a tip of  {!TipAmount}
for a total bill of {!TotalBill} .</fieldText>
            <fieldType>DisplayText</fieldType>
        </fields>
    </screens>
    <startElementReference>Bill_Information</startElementReference>
</Flow>

in this visualforce page when i click next it will redirect me to next screen but when i click on previous button it doesn't go to previous screen.i tried a lot of things but not able to success.i want when previous button clicked it will show previous screen.please tell why its not showing previous screen ??

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.