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

Visualforce Error - Formula Expression is required on the action attributes
Hi
On my commandButton action I call custom controller method. I have all code in method commented (except return statement). And still get Formula Expression is required on the action attributes error whe I submit. See alot of post on this but none helping..
Here is VF page
<apex:page controller="pickListScholarshipController" >
<apex:form >
<apex:pageBlock title="Schoalrship Application Assignment " id="out">
<apex:pageBlockButtons >
<apex:commandButton value="Assign Readers" action="{!insertScoringRecords}" rerender="out" status="actStatusId"/>
<apex:commandButton value="Email Readers" action="{!submit}" rerender="out" status="actStatusId"/>
<apex:actionStatus id="actStatusId">
<apex:facet name="start">
<img src="/img/loading.gif" />
</apex:facet>
</apex:actionStatus>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Select Scholarship then Save button" collapsible="false">
<apex:selectList value="{!selectedScholarship}" multiselect="false" size="1">
<apex:selectOption itemValue="{!selectedScholarship}" itemLabel="{!selectedScholarship}" />
<apex:selectOption itemValue="Alumni Endowed Scholarship" itemLabel="Alumni Endowed Scholarship"/>
<apex:selectOption itemValue="Danny Burkett Memorial Scholarship" itemLabel="Danny Burkett Memorial Scholarship"/>
<apex:selectOption itemValue="Kyle O'Connell Memorial Scholarship" itemLabel="Kyle O'Connell Memorial Scholarship"/>
<apex:selectOption itemValue="Senior Class Legacy Scholarship" itemLabel="Senior Class Legacy Scholarship"/>
<apex:selectOption itemValue="Kyle O'Connell Memorial Scholarship" itemLabel="Kyle O'Connell Memorial Scholarship"/>
<apex:selectOption itemValue="Terry Whitcomb Scholarship" itemLabel="Terry Whitcomb Scholarship"/>
<apex:selectOption itemValue="Beckman Program Application" itemLabel="Beckman Program Application"/>
<apex:selectOption itemValue="SURE Scholarship" itemLabel="SURE Scholarship"/>
<apex:selectOption itemValue="PURE Scholarship" itemLabel="PURE Scholarship"/>
</apex:selectList>
<apex:outputText value="{!selectedScholarship}" label="You have selected:"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
And controller:
public class pickListScholarshipController {
public String selectedScholarship;
public pickListScholarshipController (){
}
public PageReference save(){
return null;
}
public PageReference submit() {
return null;
}
public String getSelectedScholarship() {
return selectedScholarship;
}
public void setSelectedScholarship(String s) {
selectedScholarship = s;
}
public String insertScoringRecords() {
/*
USD_Scholarship_Scoring__c[] scoringRecs;
USD_Roles__c[] readers;
Date today = Date.today();
Integer year = today.year();
String yearToQuery = year+'-'+year+1;
Integer len, i;
ID contact;
List<USD_Scholarship_Scoring__c> scholarshipExists = new List<USD_Scholarship_Scoring__c>([SELECT ID, SUID__c FROM USD_Scholarship_Scoring__c ]);
Set<Id> setIds = new Set<Id>();
for (USD_Scholarship_Scoring__c obj:scholarshipExists){
setIds.add(obj.SUID__c);
}
List<USD_Scholarship__c> scholarshipList = new List<USD_Scholarship__c>();
scholarshipList = ([SELECT ID
FROM USD_Scholarship__c
WHERE Submit_Term_Year__c = :yearToQuery
AND name = :selectedScholarship
AND SUID__c NOT IN :setIds] );
readers= ([SELECT ID, Contact__c
FROM USD_Roles__c
WHERE Scholarship_Name__c = :selectedScholarship
AND Start_Date__c <= TODAY
AND End_Date__c > TODAY] );
len = readers.size();
for(USD_Scholarship__c s : scholarshipList) {
if(i>len){
i=0;
}
// assign application to next 3 readers
if ( len>0 ) {
// scoringRecs = new USD_Scholarship_Scoring__c[]{new USD_Scholarship_Scoring__c(Reader_Contact__c=readers[i++].Contact__c, ScholarshipSUID__c=s.ID),
// new USD_Scholarship_Scoring__c(Reader_Contact__c=readers[i++].Contact__c, ScholarshipSUID__c=s.ID),
// new USD_Scholarship_Scoring__c(Reader_Contact__c=readers[i++].Contact__c, ScholarshipSUID__c=s.ID) };
}
}
if ( len>0 ) {
// insert scoringRecs;
}
*/
return 'success';
}
}
Thanks for everyone's help,
Jon
On my commandButton action I call custom controller method. I have all code in method commented (except return statement). And still get Formula Expression is required on the action attributes error whe I submit. See alot of post on this but none helping..
Here is VF page
<apex:page controller="pickListScholarshipController" >
<apex:form >
<apex:pageBlock title="Schoalrship Application Assignment " id="out">
<apex:pageBlockButtons >
<apex:commandButton value="Assign Readers" action="{!insertScoringRecords}" rerender="out" status="actStatusId"/>
<apex:commandButton value="Email Readers" action="{!submit}" rerender="out" status="actStatusId"/>
<apex:actionStatus id="actStatusId">
<apex:facet name="start">
<img src="/img/loading.gif" />
</apex:facet>
</apex:actionStatus>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Select Scholarship then Save button" collapsible="false">
<apex:selectList value="{!selectedScholarship}" multiselect="false" size="1">
<apex:selectOption itemValue="{!selectedScholarship}" itemLabel="{!selectedScholarship}" />
<apex:selectOption itemValue="Alumni Endowed Scholarship" itemLabel="Alumni Endowed Scholarship"/>
<apex:selectOption itemValue="Danny Burkett Memorial Scholarship" itemLabel="Danny Burkett Memorial Scholarship"/>
<apex:selectOption itemValue="Kyle O'Connell Memorial Scholarship" itemLabel="Kyle O'Connell Memorial Scholarship"/>
<apex:selectOption itemValue="Senior Class Legacy Scholarship" itemLabel="Senior Class Legacy Scholarship"/>
<apex:selectOption itemValue="Kyle O'Connell Memorial Scholarship" itemLabel="Kyle O'Connell Memorial Scholarship"/>
<apex:selectOption itemValue="Terry Whitcomb Scholarship" itemLabel="Terry Whitcomb Scholarship"/>
<apex:selectOption itemValue="Beckman Program Application" itemLabel="Beckman Program Application"/>
<apex:selectOption itemValue="SURE Scholarship" itemLabel="SURE Scholarship"/>
<apex:selectOption itemValue="PURE Scholarship" itemLabel="PURE Scholarship"/>
</apex:selectList>
<apex:outputText value="{!selectedScholarship}" label="You have selected:"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
And controller:
public class pickListScholarshipController {
public String selectedScholarship;
public pickListScholarshipController (){
}
public PageReference save(){
return null;
}
public PageReference submit() {
return null;
}
public String getSelectedScholarship() {
return selectedScholarship;
}
public void setSelectedScholarship(String s) {
selectedScholarship = s;
}
public String insertScoringRecords() {
/*
USD_Scholarship_Scoring__c[] scoringRecs;
USD_Roles__c[] readers;
Date today = Date.today();
Integer year = today.year();
String yearToQuery = year+'-'+year+1;
Integer len, i;
ID contact;
List<USD_Scholarship_Scoring__c> scholarshipExists = new List<USD_Scholarship_Scoring__c>([SELECT ID, SUID__c FROM USD_Scholarship_Scoring__c ]);
Set<Id> setIds = new Set<Id>();
for (USD_Scholarship_Scoring__c obj:scholarshipExists){
setIds.add(obj.SUID__c);
}
List<USD_Scholarship__c> scholarshipList = new List<USD_Scholarship__c>();
scholarshipList = ([SELECT ID
FROM USD_Scholarship__c
WHERE Submit_Term_Year__c = :yearToQuery
AND name = :selectedScholarship
AND SUID__c NOT IN :setIds] );
readers= ([SELECT ID, Contact__c
FROM USD_Roles__c
WHERE Scholarship_Name__c = :selectedScholarship
AND Start_Date__c <= TODAY
AND End_Date__c > TODAY] );
len = readers.size();
for(USD_Scholarship__c s : scholarshipList) {
if(i>len){
i=0;
}
// assign application to next 3 readers
if ( len>0 ) {
// scoringRecs = new USD_Scholarship_Scoring__c[]{new USD_Scholarship_Scoring__c(Reader_Contact__c=readers[i++].Contact__c, ScholarshipSUID__c=s.ID),
// new USD_Scholarship_Scoring__c(Reader_Contact__c=readers[i++].Contact__c, ScholarshipSUID__c=s.ID),
// new USD_Scholarship_Scoring__c(Reader_Contact__c=readers[i++].Contact__c, ScholarshipSUID__c=s.ID) };
}
}
if ( len>0 ) {
// insert scoringRecs;
}
*/
return 'success';
}
}
Thanks for everyone's help,
Jon
For method insertScoringRecords() instead of returning the string change return type to PageReference and return null
public PageReference insertScoringRecords(){
//Instead of return 'Success';
return null;
}
Regards,
Bhanu Mahesh