You need to sign in to do that
Don't have an account?
Display a VF page after clickin on command button, depending on selected value from list box
Hi,
i am new to salesforce. i hv a simple doubt:
public PageReference GotoCSV() {
if (selectedValue == 'FlatFile')
{
PageReference newpage = new PageReference('/apex/UploadAccounts1');
newpage.setRedirect(true);
return newpage;
}
}
i want to display 'UploadAccounts1' page when user selects 'FlatFile' from the dropdown list and clicks the command button. however m getting following error in the controller "Non-void method might not return a value or might have statement after a return statement"
this is my VF page:
<apex:form >
<font color='grey'> Connection type </font><apex:selectList id="chooseColor" value="{!string}" size="1">
<apex:selectOption itemValue="Any connection type" itemLabel="- - Any connection type - -"/>
<apex:selectOption itemValue="FlatFile" itemLabel="Flat File"/>
<apex:selectOption itemValue="SQLServer2008" itemLabel="SQL Server 2008"/>
<apex:selectOption itemValue="MsAccess" itemLabel="MS Access"/>
</apex:selectList>
<apex:commandButton action="{!GotoCSV}" value="Create Connection" id="theBtn1" style="width:100px; height: 25px;"/>
</apex:form>
Can anyone please provide a solution
<apex:selectList id="chooseColor" value="{!string}" size="1">
to
<apex:selectList id="chooseColor" value="{!selectedValue}" size="1">
All Answers
public PageReference GotoCSV() {
if (selectedValue == 'FlatFile')
{
PageReference newpage = new PageReference('/apex/UploadAccounts1');
newpage.setRedirect(true);
return newpage;
}
return null;
}
Hi,
I tried adding return null; but then it remains on the same page no matter whatever I select from the drop down.
Please provide another solution
<apex:selectList id="chooseColor" value="{!string}" size="1">
to
<apex:selectList id="chooseColor" value="{!selectedValue}" size="1">
ya i already found that mistake and it worked fine..
anyway Thanks