You need to sign in to do that
Don't have an account?
Chitral Chadda
show selected picklist value in other vf pge
it dosent work issue is with id
<apex:page controller="showpick">
<apex:sectionHeader title="this is section header title"/>
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="this is page block section title" columns="2">
<apex:selectList size="1" value="{!selectedcountry}">
<apex:selectOptions value="{!country}"/>
<apex:actionSupport event="onchange" rerender="save"/>
</apex:selectList>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
class:
public class showpick
{
public string selectedcountry{get;set;}
public showpick()
{}
public list<selectoption> getcountry()
{
list<selectoption> options = new list<selectoption>();
options.add(new selectoption('-','none'));
options.add(new selectoption('abc','a'));
options.add(new selectoption('xyz','x'));
return options;
}
public pagereference save()
{
pagereference pref = new pagereference('/apex/show?id='+id);
pref.setredirect(true);
return pref;
}
}
Error Error: showpick Compile Error: Variable does not exist: id at line 19 column 63
other vf page
<apex:page standardController="account">
<apex:pageBlock>
<apex:pageBlockSection>
<apex:outputText label="you selected" value="{!selectedcountry}">
</apex:outputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
<apex:page controller="showpick">
<apex:sectionHeader title="this is section header title"/>
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="this is page block section title" columns="2">
<apex:selectList size="1" value="{!selectedcountry}">
<apex:selectOptions value="{!country}"/>
<apex:actionSupport event="onchange" rerender="save"/>
</apex:selectList>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
class:
public class showpick
{
public string selectedcountry{get;set;}
public showpick()
{}
public list<selectoption> getcountry()
{
list<selectoption> options = new list<selectoption>();
options.add(new selectoption('-','none'));
options.add(new selectoption('abc','a'));
options.add(new selectoption('xyz','x'));
return options;
}
public pagereference save()
{
pagereference pref = new pagereference('/apex/show?id='+id);
pref.setredirect(true);
return pref;
}
}
Error Error: showpick Compile Error: Variable does not exist: id at line 19 column 63
other vf page
<apex:page standardController="account">
<apex:pageBlock>
<apex:pageBlockSection>
<apex:outputText label="you selected" value="{!selectedcountry}">
</apex:outputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
If you want use that variable as property please use getter setter methods.
All Answers
If you want use that variable as property please use getter setter methods.
i made the change
and when after select the pick list value
https://c.ap1.visual.force.com/apex/v?id=null
other vf page (rpage refernce)
Error Error: Unknown property 'AccountStandardController.selectedcountry'
<apex:page standardController="account">
<apex:pageBlock>
<apex:pageBlockSection>
<apex:outputText label="you selected" value="{!selectedcountry}">
</apex:outputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
You have to set a value before you use it.
Please update the logic of your code.
cz my actual requuiremnt is that wen i select a value from piklist it shud display that select value in other vf page
Error Error: Unknown property 'AccountStandardController.selectedcountry'
<apex:page standardController="account">
<apex:pageBlock>
<apex:pageBlockSection>
<apex:outputText label="you selected" value="{!selectedcountry}">
</apex:outputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
do i need to make change in this particular part of code?