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
Chandra babu 2Chandra babu 2 

How to give the link one Button to another button

if suppose i had created Two fields on main page 1)Enter an Area   2)Find the Restaurents.

Now we clickon Enter an area Some values are Shown,click on That Value,,,,
After we go for click on  Find the restaurents .....To display the restaurents page.


pls tel me
Best Answer chosen by Chandra babu 2
sachin kadian 5sachin kadian 5
If I am understanding right, Find the Restaurants is a button and when you click on this button, you want to move to next page. 
 
<apex:CommandButton value="Find the Restaurant" action="{!gotoRestaurantPage}" />


in Apex - 

public pageReference gotoRestaurantPage(){
    PageReference pg = new PageReference('/apex/restaurancePage');
    return pg;
}


if you want to send the area name as parameter to next page, then do it like this - 


<apex:selectList value="{!areaName}" ........./>
<apex:CommandButton value="Find the Restaurant" action="{!gotoRestaurantPage}" />


in Apex - 
public String areaName{get;set;}
public pageReference gotoRestaurantPage(){
    PageReference pg = new PageReference('/apex/restaurancePage?areaName='+areaname);
    return pg;
}

 

All Answers

sachin kadian 5sachin kadian 5
If I am understanding right, Find the Restaurants is a button and when you click on this button, you want to move to next page. 
 
<apex:CommandButton value="Find the Restaurant" action="{!gotoRestaurantPage}" />


in Apex - 

public pageReference gotoRestaurantPage(){
    PageReference pg = new PageReference('/apex/restaurancePage');
    return pg;
}


if you want to send the area name as parameter to next page, then do it like this - 


<apex:selectList value="{!areaName}" ........./>
<apex:CommandButton value="Find the Restaurant" action="{!gotoRestaurantPage}" />


in Apex - 
public String areaName{get;set;}
public pageReference gotoRestaurantPage(){
    PageReference pg = new PageReference('/apex/restaurancePage?areaName='+areaname);
    return pg;
}

 
This was selected as the best answer
Himanshu MaheshwariHimanshu Maheshwari
You can also achieve by single VF page. It will work sismilar to below code.
 
<apex:form id="frm">
        <apex:pageBlock >
            <apex:pageBlockSection title="Select Restra">
                <apex:selectList value="{!selectedArea}" size="1" label="Area" onchange="abc();">
                    <apex:selectOptions value="{!AreaList}"/>
                </apex:selectList>
                <apex:actionFunction action="{!getFindRestra}" immediate="true" name="abc" reRender="frm"/>
                <apex:selectList value="{!selectedR}" size="1" label="Restra" >
                    <apex:selectOptions value="{!rList}"/>
                </apex:selectList>
            </apex:pageBlockSection>
            <center> <apex:commandButton value="Save" action="{!UpdateRestra}"/> </center>
        </apex:pageBlock>
    </apex:form>

 
Chandra babu 2Chandra babu 2
thanq very much Himanshu
Chandra babu 2Chandra babu 2
thanq sachin