You need to sign in to do that
Don't have an account?
Justin D
Invalid selectOptions found. Use SelectOption type in Apex (why?)
I was trying to add a dropdown menu inside VF page (where I already have other pageBlockTables).
I only need to retrieve one field (c.sfprn) from an existing SOQL query where it is already used for other pageBlockTables.
Here is part of my VF page (where I am trying to add a dropdown menu) :
<!-- DropDown Menu starts -->
<apex:pageBlockTable value="{!RowList}" var="c">
<apex:column >
<apex:facet name="header">All Surveys</apex:facet>
<span>All Surveys: </span>
<apex:selectList id="AllSurvey" size="1">
<apex:selectOptions value="http://www.test.com?sfprn={!c.sfprn}&id=1>Test1</apex:selectOptions>
<apex:selectOptions value="http://www.test.com?sfprn={!c.sfprn}&id=2>Test1</apex:selectOptions>
</apex:column>
</apex:pageBlockTable>
<!-- DropDown Menu ends -->
Here is portion of Apex code:
public PageReference searchPatients(){
RowList = new List<TableRow2>();
TableRow2 tr;
for(Patient__c con : [SELECT sfprn__c,
mrn__c,
LName__c,
FName__c,
(select SurveySelection__c.SurveySelection__c from SurveySelections__r)
FROM Patient__c
where mrn__c =:mrn
or LName__c =:lname LIMIT 1
]){
tr = new TableRow2();
tr.sfprn = con.sfprn__c;
tr.mrn = con.mrn__c;
tr.lname = con.LName__c;
tr.fname = con.FName__c;
tr.SurveySelection = con.SurveySelections__r.isEmpty() ? null : con.SurveySelections__r[0].SurveySelection__c;
RowList.add(tr);
}
return null;
}
I am curious whether I need to add a new method in Apex or I could just call the value="{!RowList}" to bring one field (c.sfprn).
Thanks in advance.
I only need to retrieve one field (c.sfprn) from an existing SOQL query where it is already used for other pageBlockTables.
Here is part of my VF page (where I am trying to add a dropdown menu) :
<!-- DropDown Menu starts -->
<apex:pageBlockTable value="{!RowList}" var="c">
<apex:column >
<apex:facet name="header">All Surveys</apex:facet>
<span>All Surveys: </span>
<apex:selectList id="AllSurvey" size="1">
<apex:selectOptions value="http://www.test.com?sfprn={!c.sfprn}&id=1>Test1</apex:selectOptions>
<apex:selectOptions value="http://www.test.com?sfprn={!c.sfprn}&id=2>Test1</apex:selectOptions>
</apex:column>
</apex:pageBlockTable>
<!-- DropDown Menu ends -->
Here is portion of Apex code:
public PageReference searchPatients(){
RowList = new List<TableRow2>();
TableRow2 tr;
for(Patient__c con : [SELECT sfprn__c,
mrn__c,
LName__c,
FName__c,
(select SurveySelection__c.SurveySelection__c from SurveySelections__r)
FROM Patient__c
where mrn__c =:mrn
or LName__c =:lname LIMIT 1
]){
tr = new TableRow2();
tr.sfprn = con.sfprn__c;
tr.mrn = con.mrn__c;
tr.lname = con.LName__c;
tr.fname = con.FName__c;
tr.SurveySelection = con.SurveySelections__r.isEmpty() ? null : con.SurveySelections__r[0].SurveySelection__c;
RowList.add(tr);
}
return null;
}
I am curious whether I need to add a new method in Apex or I could just call the value="{!RowList}" to bring one field (c.sfprn).
Thanks in advance.
The class SelectOption can be added in the Apex code like that:
Regards
A button can be added near the drop down menu with a javascript function.
Regards