My page
<apex:pageblocksectionItem >
<apex:outputlabel value="Date Format"/>
<Apex:selectlist value="{!dateval}" size="1" style="width:100px;">
<Apex:selectoptions value="{!datevalues}"></Apex:selectoptions>
</Apex:selectlist>
</apex:pageblocksectionItem>
<apex:pageBlockSectionItem >
<Apex:outputLabel value="Counter Seed"></Apex:outputLabel>
<apex:inputtext value="{!Settings.Counter__c}" maxlength="10" />
</apex:pageBlockSectionItem>
My class is
string dateval='yyyy';
public void setdateval(string S){this.dateval= S;}
public string getdateval(){return dateval;}
public list<selectoption> getdatevalues(){
list<selectoption> Value = new list<selectoption>();
Value.add(new Selectoption('dd-mm-yyyy','dd-mm-yyyy'));
value.add(new selectoption('mm-dd-yyyy','mm-dd-yyyy'));
value.add(new selectoption('mm/dd/yyyy','mm/dd/yyyy'));
}
public void SaveSetting(){
Sett.Date_Format__c = this.dateval;
Sett.Counter__c = Settings.Counter__c;
}
here whence I click on save text field is inserted but picklist value is not inserted.I need to get picklist value also inserted.how can I do it.
Attribution to: Eagerin Sf
Possible Suggestion/Solution #1
Try a different construction for the getter/setter of dateVal:
public class YourClass {
public String dateVal {
get { return dateVal; }
set { dateVal = value; }
}
}
This is from the SFDC Apex doc on properties. 'value' is an implicit keyword referring to the value passed by the VF page (or any caller)
Attribution to: cropredy
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4647