Skip to main content

Hi,

 

Can anyone help or suggest for my issue. Not able to redirect the page in "Login Flows". Below is my requirement. I have two visualforce pages and one controller. In the first visualforce page user will select rating in the html slider then click the next button, system should redirect to second Visualforce page to enter the improvement feedback.

 

First VF Page Code :

******************

 

<apex:page controller="RadioBtn_SmileyTable_Apex" showHeader="false" 

           applyHtmlTag="true" applyBodyTag="false" lightningStylesheets="true" docType="html-5.0" id="lf1">

    <apex:form styleClass="fswrapper" id="frm">

        <center>

        <img src="{!$Resource.FoxWhiteBackground1}"/> 

        </center>

        <apex:pageBlock id="pgb1">

            

                <apex:outputLabel value="{!Appname}" id="opl1" styleClass="headerTitle"></apex:outputLabel>

            

                          <apex:pageBlockButtons location="bottom" id="pgbtn1" >

                              

                              <apex:commandButton value="Submit" action="{!savefeedback}" 

                           style="font-size: 15px;" id="smtbtn" />

                                   

                    <apex:commandButton value="Next" action="{!redirect}" 

                                style="font-size: 15px;" id="nxtbtn"/>

                                        

                            <apex:commandButton value="Exit" action="{!feedbackexit}" 

                                              style="font-size: 15px;" id="cmd3"/>

               </apex:pageBlockButtons>

            

            <apex:actionRegion id="acg1">

                <Table id="q1" class="big">

                    <div>

                        <tr>

                            <td>

                                <p style="font-size: 20px; width: 380px;">

                           <b> How satisified you are with our Service? </b>

                        </p> 

                            </td>

                        </tr>

                    </div>

                </Table> 

                <Table width="100%" border="0" cellpadding="0" cellspacing="0" columns="0"  id="ta23"> 

              <tr >

                    <td >  

                          <!-- Start Smiley -->

                           <div class="container">

                                  <input type="range" id="my-slider" min="1" max="10" value="1" 

                                       oninput="slider()"/>

                               <div id="slider-value" style="font-size: 20px;"><p id="rangeValue">1</p></div>

                               

                                <apex:actionFunction action="{!SelectedAnswer}" name="selectValue" reRender="acg1">

                                  <apex:param name="conid" value=""/>

                             </apex:actionFunction>

                           </div>    

                           <div>

                              <tr>

                                  <td>

                                     <label><img src="{!$Resource.a}"/></label>

                                              

                                     <label><img src="{!$Resource.b}"/></label>

                                              

                                     <label><img src="{!$Resource.c}"/></label>

                                              

                                     <label><img src="{!$Resource.d}" /></label>

                                              

                                     <label><img src="{!$Resource.e}"/></label>   

                                              

                                     <label><img src="{!$Resource.f}"/></label>

                                              

                                     <label><img src="{!$Resource.g}"/></label>

                                              

                                     <label><img src="{!$Resource.h}"/></label>

                                              

                                     <label><img src="{!$Resource.i}"/></label>

                                              

                                     <label><img src="{!$Resource.j}"/></label>                                          

                             </td>

                         </tr>

                    </div>

                         <!-- End Smiley-->

                        </td>

                     </tr> 

                 </Table>    

           </apex:actionRegion> 

        </apex:pageBlock>

    </apex:form>

</apex:page>

 

Apex Controller :

***************

 

public   class RadioBtn_SmileyTable_Apex

{

    

    public RB_Rating__c ratobj {get;set;} 

    public string Selected {get;set;}

    public string Appname {get;set;}

    public string EnteredText {get;set;}

    public string Redirect {get;set;}

   

    public RadioBtn_SmileyTable_Apex()

    {

       ratobj = new RB_Rating__c();

       Appname = 'Application Name - ' + getAppName();

    }

    

    Public void SelectedAnswer()

    {

        

        Selected = Apexpages.currentPage().getParameters().get('conid');

    }

    public pagereference savefeedback()

    {

        Redirect = apexpages.currentpage().getparameters().get('Id');

        ratobj.Application_Name__c = getAppName();

        if(string.isBlank(Redirect))

        {

          ratobj.Application_Rating__c = Selected;  

        }

        else

        {

            ratobj.Application_Rating__c = Redirect;

        }        

        ratobj.Description__c = EnteredText;

        insert ratobj; 

       return Auth.SessionManagement.FinishLoginflow('/'+ratobj.Id);

    }

    

    public pagereference feedbackexit()

    {        

       return Auth.SessionManagement.FinishLoginflow('/');

    }

    

    public pagereference redirect()

    {

 

       PageReference pg = new PageReference('/apex/Slider_Rating_Redir_VF?id='+Selected);

       pg.setRedirect(true);

       return pg;

    }    

    public static String getAppName() 

    {

    UserAppInfo userAppInfo = [SELECT Id, AppDefinitionId FROM UserAppInfo WHERE UserId = :UserInfo.getUserId() LIMIT 1];

    AppDefinition appDefinition = [SELECT DurableId, Label FROM AppDefinition Where DurableId = :userAppInfo.AppDefinitionId LIMIT 1];

        return appDefinition.Label;  

    }

}

 

Not able to redirect the page in

 

Please help me where i am doing wrong.

 

Thanks

2 answers
  1. Dec 31, 2022, 5:20 AM

    Hi Zaheer Khan,

     

    Thank you very much for your reply.

     

    Modified the code based on your suggestions. Getting same error while saving the error. below is the error

     

    Hi Zaheer Khan, Thank you very much for your reply. Modified the code based on your suggestions. Getting same error while saving the error.

    Please help me

0/9000