function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Unable to navigate to new page on click of Command button in Panel grid object



I am trying to navigate to a VF page on click of the button in a panel grid. Here I want the reference Id to be passed to the class and hence I have used <apex:param> to pass the value. I am unable to get this reference passed to the code.

Below is the part of the apex page:


<apex:page standardController="Order__c" extensions="Order_Mobile" action="{!getPhone}" sidebar="false"    >
    <apex:form title="{!ord.Name}-{!ord.Id}">
        <apex:pageBlock title="Handsets" id="pblk">
            <apex:pageBlockSection id="blksec" columns="4" title="Now choose a Pay monthly mobile phone">
                <apex:repeat value="{!phone}" var="p">
                    <apex:outputPanel style="width: 100%; float: left;">
                        <apex:panelGrid columns="1" id="grid">
                            <apex:outputText value="{!p.Brand__c}" style="height:12px;font-family:Georgia;color:black;font-size:15px"/>
                            <apex:CommandLink value="{!p.Name}" action="/{!p.Id}" style="height:10px;font-family:Georgia;color:blue;font-size:10px"/>
                            <apex:image value="{!p.ImgURL__c}" />
                            <apex:commandButton value="Select & view plans" >
                                <apex:actionSupport event="onclick" action="{!selectphone}" rerender="">
                                    <apex:param name="phonemod" value="{!p.Id}" assignTo="{!phonemod}"/>
            <apex:pageBlockSection >
                <apex:commandButton value="Skip" action="{!selectplan}" />
                <apex:commandButton value="Cancel" action="{!cancelAll}" />


"selectphone" is the function in which I am storing the reference in the class and navigating to the next page.


I need help to pass this reference and navigate to the next page.

Thanks in advance for the help.



Apex:actionSupport is used with those component which don't have their own Action attribue.But the command button has action attribute so u not need to add apex:actionSupport.


<apex:commandButton value="Select & view plans" action="{!selectphone}" rerender="pass Some component id" >
            <apex:param name="phonemod" value="{!p.Id}" assignTo="{!phonemod}"/>



Please let me know if u have any problem on same and if this post helps u please throw KUDOS.


If you specify a rerender attribute, you won't be able to navigate to a new page, as rerender applies elements of the updated page to the current page.


Unfortunately, if you take out the rerender, it will break the parameter passing.


There are a couple of options to solve this:


(1) Replace the commandbutton with a commandlink styled to look like a button - the parameter passing works for this without a rerender

(2) Set a flag to conditionally rerender some JavaScript that redirects the user to the new page once the action completes - there's an example of this on my blog at: