You need to sign in to do that
Don't have an account?

I cannot save my picklist filed values into object from vf page
I have a problem that i created a vf page and controller also but the problem is i cannot save the picklist field Agency_tier __c into fiel new protest object ...i dont know why...this is a picklist field (<apex:inputField value="{!File_New_Protest__c.Agency_Tier1__c}"/>) but am unable to save this field into an object ...when i click on save remaining all the fields are saving but this picklist field value is not saving
My vf page:
<apex:page standardController="File_New_Protest__c" Extensions="Filenewexten">
<apex:sectionHeader title="Protest Info Form" />
<apex:form id="fid">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock >
<apex:pageBlockSection title="Protester " columns="3">
<table>
<tr>
<td>
Company Name:
<apex:inputText value="{!CompanyName}" />
</td>
</tr>
<tr>
<td>
<apex:selectRadio value="{!File_New_Protest__c.Size_Status__c}">
<apex:selectoptions value="{!typess}"></apex:selectoptions>
</apex:selectRadio>
</td>
</tr>
</table>
</apex:pageBlockSection>
<apex:pageBlockSection title="Company Address" columns="2">
<table>
<div style="padding-top: 15px;padding-bottom: 15px;padding-left: 70px;">
<input type="checkbox" name="sameasadress" id="sameasaddressid"><label> Same as Protester Representative address below</label>
</input>
</div>
<tr>
<td>
Street Name:
<apex:inputText value="{!StreetName}" id="cstreet"/>
</td>
</tr>
<tr>
<td>
City:
<apex:inputText value="{!City}"/>
</td>
</tr>
<tr>
<td>
State:
<apex:inputText value="{!State}" />
</td>
</tr>
<tr>
<td>
Country:
<apex:inputText value="{!Country}" />
</td>
</tr>
<tr>
<td>
Zip Code:
<apex:inputText value="{!ZipCode}" />
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageBlock>
<!--<apex:pageblock >
<apex:pageBlockTable value="{!DueFromEntityDetials}" var="Ent" style="font-size:1.1em;" id="TheBlock">
<apex:pageBlockSection columns="2">
<table>
<tr>
<td>
<apex:outputTExt></apex:outputTExt> value="{!Ent.First_Name__c}"/>
</td>
</tr>
<tr>
<td>
<apex:outputField value="{!Ent.Last_Name__c}"/>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageblocktable>
</apex:pageblock>-->
<apex:pageBlock >
<apex:pageBlockSection title="Protester Representative " columns="2">
<table>
<tr>
<td>
First Name:
<apex:inputText value="{!FirstName}"/>
</td>
</tr>
<tr>
<td>
Last Name:
<apex:inputText value="{!LastName}"/>
</td>
</tr>
<tr>
<td>
Email Address:
<apex:inputText value="{!Email}" />
</td>
</tr>
<tr>
<td>
Phone Number:
<apex:inputText value="{!PhoneNumber}" />
</td>
</tr>
<tr>
<td>
Fax Number:
<apex:inputText value="{!FaxNumber}" />
</td>
</tr>
<tr>
<td>
Street Address:
<apex:inputText value="{!StreetAddresses}" id="pstreet"/>
</td>
</tr>
<tr>
<td>
City:
<apex:inputText value="{!Cities}" />
</td>
</tr>
<tr>
<td>
State:
<apex:inputText value="{!States}" />
</td>
</tr>
<tr>
<td>
Country:
<apex:inputText value="{!Countrys}" />
</td>
</tr>
<tr>
<td>
Zipcode:
<apex:inputText value="{!ZipCode_rep}" />
</td>
</tr>
<tr>
<td>
Solicitation Number:
<apex:inputText value="{!Solocitation}" />
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Agency_Tier1__c}"/>
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Agency_Tier2__c}" />
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Comments__c}"/>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</apex:pageBlockSection>
<apex:pageBlockSection title="Protester Representative " columns="2">
<table>
<tr>
<td>
Attachment:
<apex:inputFile accept="doc, txt, pdf" filename="{!fileName}" contentType="{!contentType}" filesize="1000" size="50" value="{!DFAttachment}"/>
</td>
</tr>
<tr>
<td>
Do you want to Upload Associated Documents
<apex:actionRegion >
<apex:actionSupport event="onchange" />
<apex:selectRadio value="{!File_New_Protest__c.Do_U_Want_To_Upload_Associated_Documents__c}">
<apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectRadio>
</apex:actionRegion>
</td>
</tr>
<tr>
<td>Upload Associated Documents
<apex:inputFile accept="doc, txt, pdf" filename="{!fileName}" contentType="{!contentType}" filesize="10000" size="50" value="{!DFAttachment}" id="DocID"/>
</td>
<td>
</td>
</tr>
<tr>
<td>
<!--<apex:param name="aid" value="" />-->
<apex:commandButton value="Save" action="{!SaveDueFrom}"/>
</td>
</tr>
<tr colspan="2">
<td colspan="2">
<!--<apex:param name="aid" value="" />-->
<apex:commandButton value="Submit" action="{!searchAndfind}"/>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageBlock>
<script type="text/javascript">
$('#sameasaddressid').click(function(event) {
if(this.checked==true)
{
$('#ccountry').val($('#pcountry').val());
$('#cstate').val($('#pstate').val());
$('#ccity').val($('#pcity').val());
$('#czipcode').val($('#pzipcode').val());
$('#cstreet').val($('#pstreet').val());
}else
{
$('#ccountry').val("");
$('#cstate').val("");
$('#ccity').val("");
$('#czipcode').val("");
$('#cstreet').val("");
}
});
</script>
</apex:form>
</apex:page>
My controller:
public with sharing class Filenewexten {
public List<User_Profile__c> up { set; get; }
public Filenewexten(ApexPages.StandardController controller) {
up = [SELECT First_Name__c,Last_Name__c,Email__c,Phone_Number__c,Fax_Number__c,Street_Name__c,City_del__c,State__c,Country_del__c,Zip_Code__c FROM User_Profile__c];
FirstName = up[0].First_Name__c;
LastName = up[0].Last_Name__c;
Email = up[0].Email__c;
PhoneNumber = up[0].Phone_Number__c;
FaxNumber = up[0].Fax_Number__c;
StreetAddresses = up[0].Street_Name__c;
Cities = up[0].City_del__c;
States = up[0].State__c;
Countrys = up[0].Country_del__c;
ZipCode_rep = up[0].Zip_Code__c;
}
public string CompanyName{get;set;}
public string StreetName{get;set;}
public string City{get;set;}
public string State{get;set;}
public string Country{get;set;}
public string ZipCode{get;set;}
public string FirstName{get;set;}
public string LastName{get;set;}
public string Email{get;set;}
public string PhoneNumber{get;set;}
public string FaxNumber{get;set;}
public string StreetAddresses{get;set;}
public string Cities{get;set;}
public string States{get;set;}
public string Solocitation{get;set;}
public string Countrys{get;set;}
public string ZipCode_rep{get;set;}
// public string CompanyName{get;set;}
public String fileName {get; set;}
public String contentType {get; set;}
public Blob DFAttachment{get; set;}
public list <User_Profile__c> objEntityDetailss=new list<User_Profile__c>();
public List<SelectOption> getAgencyInfo(){
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult =
File_New_Protest__c.Agency_Tier1__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}
public List<SelectOption> getTypes(){
Schema.sObjectType sobject_type = File_New_Protest__c.getSObjectType();
Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
List<Schema.PicklistEntry> pick_list_values = field_map.get('Do_U_Want_To_Upload_Associated_Documents__c').getDescribe().getPickListValues();
List<selectOption> options = new List<selectOption>();
for (Schema.PicklistEntry a : pick_list_values) {
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}
public List<SelectOption> getTypess(){
Schema.sObjectType sobject_type = File_New_Protest__c.getSObjectType();
Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
List<Schema.PicklistEntry> pick_list_values = field_map.get('Size_Status__c').getDescribe().getPickListValues();
List<selectOption> options = new List<selectOption>();
for (Schema.PicklistEntry a : pick_list_values) {
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}
public List<User_Profile__c> getDueFromEntityDetials()
{
objEntityDetailss=[SELECT Id,First_Name__c,Last_Name__c FROM User_Profile__c];
return objEntityDetailss;
}
public Void SaveDueFrom(){
File_New_Protest__c Insertfile=New File_New_Protest__c();
Insertfile.Street_Name__c=StreetName;
Insertfile.City__c=City;
Insertfile.State__c=State;
Insertfile.Country__c=Country;
Insertfile.Zip_Code__c=ZipCode;
Insertfile.Company_Name__c=CompanyName;
if(DFAttachment!=null)
{
Insertfile.IsAttached__c=1;
}
else{
Insertfile.IsAttached__c=0;
}
//INSERT insertBal;
insert(Insertfile);
{
if(DFAttachment!=null){
Attachment attach=new Attachment();
attach.Body=DFAttachment;
attach.Name=filename;
attach.ContentType=contentType;
attach.ParentID=Insertfile.id;
insert(attach);
attach.clear();
Insertfile.clear();
DFAttachment=null;
}
}
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Saved Successfully');
}
public pageReference searchAndfind() {
pageReference pg = new pageReference('https://c.ap1.visual.force.com/apex/Activeprotests');
pg.setRedirect(true);
return pg;
}
}
Please help me in saving this picklist field into file new protest object...i am calling this from standard controller only thanks.....
My vf page:
<apex:page standardController="File_New_Protest__c" Extensions="Filenewexten">
<apex:sectionHeader title="Protest Info Form" />
<apex:form id="fid">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock >
<apex:pageBlockSection title="Protester " columns="3">
<table>
<tr>
<td>
Company Name:
<apex:inputText value="{!CompanyName}" />
</td>
</tr>
<tr>
<td>
<apex:selectRadio value="{!File_New_Protest__c.Size_Status__c}">
<apex:selectoptions value="{!typess}"></apex:selectoptions>
</apex:selectRadio>
</td>
</tr>
</table>
</apex:pageBlockSection>
<apex:pageBlockSection title="Company Address" columns="2">
<table>
<div style="padding-top: 15px;padding-bottom: 15px;padding-left: 70px;">
<input type="checkbox" name="sameasadress" id="sameasaddressid"><label> Same as Protester Representative address below</label>
</input>
</div>
<tr>
<td>
Street Name:
<apex:inputText value="{!StreetName}" id="cstreet"/>
</td>
</tr>
<tr>
<td>
City:
<apex:inputText value="{!City}"/>
</td>
</tr>
<tr>
<td>
State:
<apex:inputText value="{!State}" />
</td>
</tr>
<tr>
<td>
Country:
<apex:inputText value="{!Country}" />
</td>
</tr>
<tr>
<td>
Zip Code:
<apex:inputText value="{!ZipCode}" />
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageBlock>
<!--<apex:pageblock >
<apex:pageBlockTable value="{!DueFromEntityDetials}" var="Ent" style="font-size:1.1em;" id="TheBlock">
<apex:pageBlockSection columns="2">
<table>
<tr>
<td>
<apex:outputTExt></apex:outputTExt> value="{!Ent.First_Name__c}"/>
</td>
</tr>
<tr>
<td>
<apex:outputField value="{!Ent.Last_Name__c}"/>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageblocktable>
</apex:pageblock>-->
<apex:pageBlock >
<apex:pageBlockSection title="Protester Representative " columns="2">
<table>
<tr>
<td>
First Name:
<apex:inputText value="{!FirstName}"/>
</td>
</tr>
<tr>
<td>
Last Name:
<apex:inputText value="{!LastName}"/>
</td>
</tr>
<tr>
<td>
Email Address:
<apex:inputText value="{!Email}" />
</td>
</tr>
<tr>
<td>
Phone Number:
<apex:inputText value="{!PhoneNumber}" />
</td>
</tr>
<tr>
<td>
Fax Number:
<apex:inputText value="{!FaxNumber}" />
</td>
</tr>
<tr>
<td>
Street Address:
<apex:inputText value="{!StreetAddresses}" id="pstreet"/>
</td>
</tr>
<tr>
<td>
City:
<apex:inputText value="{!Cities}" />
</td>
</tr>
<tr>
<td>
State:
<apex:inputText value="{!States}" />
</td>
</tr>
<tr>
<td>
Country:
<apex:inputText value="{!Countrys}" />
</td>
</tr>
<tr>
<td>
Zipcode:
<apex:inputText value="{!ZipCode_rep}" />
</td>
</tr>
<tr>
<td>
Solicitation Number:
<apex:inputText value="{!Solocitation}" />
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Agency_Tier1__c}"/>
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Agency_Tier2__c}" />
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Comments__c}"/>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</apex:pageBlockSection>
<apex:pageBlockSection title="Protester Representative " columns="2">
<table>
<tr>
<td>
Attachment:
<apex:inputFile accept="doc, txt, pdf" filename="{!fileName}" contentType="{!contentType}" filesize="1000" size="50" value="{!DFAttachment}"/>
</td>
</tr>
<tr>
<td>
Do you want to Upload Associated Documents
<apex:actionRegion >
<apex:actionSupport event="onchange" />
<apex:selectRadio value="{!File_New_Protest__c.Do_U_Want_To_Upload_Associated_Documents__c}">
<apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectRadio>
</apex:actionRegion>
</td>
</tr>
<tr>
<td>Upload Associated Documents
<apex:inputFile accept="doc, txt, pdf" filename="{!fileName}" contentType="{!contentType}" filesize="10000" size="50" value="{!DFAttachment}" id="DocID"/>
</td>
<td>
</td>
</tr>
<tr>
<td>
<!--<apex:param name="aid" value="" />-->
<apex:commandButton value="Save" action="{!SaveDueFrom}"/>
</td>
</tr>
<tr colspan="2">
<td colspan="2">
<!--<apex:param name="aid" value="" />-->
<apex:commandButton value="Submit" action="{!searchAndfind}"/>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageBlock>
<script type="text/javascript">
$('#sameasaddressid').click(function(event) {
if(this.checked==true)
{
$('#ccountry').val($('#pcountry').val());
$('#cstate').val($('#pstate').val());
$('#ccity').val($('#pcity').val());
$('#czipcode').val($('#pzipcode').val());
$('#cstreet').val($('#pstreet').val());
}else
{
$('#ccountry').val("");
$('#cstate').val("");
$('#ccity').val("");
$('#czipcode').val("");
$('#cstreet').val("");
}
});
</script>
</apex:form>
</apex:page>
My controller:
public with sharing class Filenewexten {
public List<User_Profile__c> up { set; get; }
public Filenewexten(ApexPages.StandardController controller) {
up = [SELECT First_Name__c,Last_Name__c,Email__c,Phone_Number__c,Fax_Number__c,Street_Name__c,City_del__c,State__c,Country_del__c,Zip_Code__c FROM User_Profile__c];
FirstName = up[0].First_Name__c;
LastName = up[0].Last_Name__c;
Email = up[0].Email__c;
PhoneNumber = up[0].Phone_Number__c;
FaxNumber = up[0].Fax_Number__c;
StreetAddresses = up[0].Street_Name__c;
Cities = up[0].City_del__c;
States = up[0].State__c;
Countrys = up[0].Country_del__c;
ZipCode_rep = up[0].Zip_Code__c;
}
public string CompanyName{get;set;}
public string StreetName{get;set;}
public string City{get;set;}
public string State{get;set;}
public string Country{get;set;}
public string ZipCode{get;set;}
public string FirstName{get;set;}
public string LastName{get;set;}
public string Email{get;set;}
public string PhoneNumber{get;set;}
public string FaxNumber{get;set;}
public string StreetAddresses{get;set;}
public string Cities{get;set;}
public string States{get;set;}
public string Solocitation{get;set;}
public string Countrys{get;set;}
public string ZipCode_rep{get;set;}
// public string CompanyName{get;set;}
public String fileName {get; set;}
public String contentType {get; set;}
public Blob DFAttachment{get; set;}
public list <User_Profile__c> objEntityDetailss=new list<User_Profile__c>();
public List<SelectOption> getAgencyInfo(){
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult =
File_New_Protest__c.Agency_Tier1__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}
public List<SelectOption> getTypes(){
Schema.sObjectType sobject_type = File_New_Protest__c.getSObjectType();
Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
List<Schema.PicklistEntry> pick_list_values = field_map.get('Do_U_Want_To_Upload_Associated_Documents__c').getDescribe().getPickListValues();
List<selectOption> options = new List<selectOption>();
for (Schema.PicklistEntry a : pick_list_values) {
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}
public List<SelectOption> getTypess(){
Schema.sObjectType sobject_type = File_New_Protest__c.getSObjectType();
Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
List<Schema.PicklistEntry> pick_list_values = field_map.get('Size_Status__c').getDescribe().getPickListValues();
List<selectOption> options = new List<selectOption>();
for (Schema.PicklistEntry a : pick_list_values) {
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}
public List<User_Profile__c> getDueFromEntityDetials()
{
objEntityDetailss=[SELECT Id,First_Name__c,Last_Name__c FROM User_Profile__c];
return objEntityDetailss;
}
public Void SaveDueFrom(){
File_New_Protest__c Insertfile=New File_New_Protest__c();
Insertfile.Street_Name__c=StreetName;
Insertfile.City__c=City;
Insertfile.State__c=State;
Insertfile.Country__c=Country;
Insertfile.Zip_Code__c=ZipCode;
Insertfile.Company_Name__c=CompanyName;
if(DFAttachment!=null)
{
Insertfile.IsAttached__c=1;
}
else{
Insertfile.IsAttached__c=0;
}
//INSERT insertBal;
insert(Insertfile);
{
if(DFAttachment!=null){
Attachment attach=new Attachment();
attach.Body=DFAttachment;
attach.Name=filename;
attach.ContentType=contentType;
attach.ParentID=Insertfile.id;
insert(attach);
attach.clear();
Insertfile.clear();
DFAttachment=null;
}
}
apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Saved Successfully');
}
public pageReference searchAndfind() {
pageReference pg = new pageReference('https://c.ap1.visual.force.com/apex/Activeprotests');
pg.setRedirect(true);
return pg;
}
}
Please help me in saving this picklist field into file new protest object...i am calling this from standard controller only thanks.....