I have a simple radio button that specifies the type of position:
<div class="lead">Position</div>
<apex:pageBlockSection columns="1">
<apex:selectRadio value="{!Job__c.Type_of_Position__c}" layout="lineDirection">
<apex:selectOption itemValue="Mentor" itemlabel="Mentor"/>
<apex:selectOption itemValue="Consultant" itemlabel="Consultant"/>
<apex:selectOption itemValue="Permanent" itemlabel="Permanent"/>
</apex:selectRadio>
</apex:pageBlockSection>
Any idea how I can set the default value to Mentor?
I tried setting a variable in the controller:
// Setting Default Options
public String posType = 'Mentor';
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Mentor','Mentor'));
options.add(new SelectOption('Consultant','Consultant'));
options.add(new SelectOption('Permanent','Permanent')); return options;
}
public String getPosType() {
return posType;
}
public void setPosType (String posType) {
this.posType = posType; }
And the VF
<div class="lead">Position</div>
<apex:pageBlockSection columns="1">
<apex:selectRadio value="{!posType}" layout="lineDirection">
<apex:selectOptions value="{!items}"/>
</apex:selectRadio>
</apex:pageBlockSection>
But no value is added when the form is submitted. How can I return the value selected?
public String posType = 'Mentor';
toString posType = 'Mentor';
.Guess this should work