You need to sign in to do that
Don't have an account?
meyerd
selectList required="true" no red bar on Visualforce Page
I have a visual force page that gets select options from a controller.
I have required="true" for the selectList.
No red bar shows on the page when it is displayed.
If I don't select a value and submit the form.
I do not get a message on the field 'You must enter a value' like I do on other fields required in the same way, but do get informed in apex:pageMessages mentioning
thePage:theForm:j_id1:j_id5:0: Validation Error: Value is required.
The field is a multiselect picklist which I am showing on the VF page as a selectList size 1 only when the user has not previously selected values for that field.
Ideas on
-why the red bar not showing?
-why is the field not being Highlighted and marked with 'Error: You must enter a value' when I submit the form?
I have required="true" for the selectList.
No red bar shows on the page when it is displayed.
If I don't select a value and submit the form.
I do not get a message on the field 'You must enter a value' like I do on other fields required in the same way, but do get informed in apex:pageMessages mentioning
thePage:theForm:j_id1:j_id5:0: Validation Error: Value is required.
The field is a multiselect picklist which I am showing on the VF page as a selectList size 1 only when the user has not previously selected values for that field.
Code:
<apex:page standardController="Opportunity" recordSetVar="opportunities" sidebar="false" showHeader="true" extensions="OpptyMultiEdit_CTE" id="thePage">
......
<apex:pageBlockTable value="{!OpptyList}" var="oppty" cellpadding="4" headerClass="TH_Class">
......
<apex:selectList required="true" size="1" value="{!oppty.Competitors__c}">
<apex:selectOptions value="{!CompetitorsPicklist}"/>
</apex:selectList>
Opportunity[] Opptys;
public List<Opportunity> getOpptyList()
{
return Opptys;
}
public List<SelectOption> getCompetitorsPicklist()
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult f = Opportunity.Competitors__c.getDescribe();
String defValue = '';
options.add( new SelectOption( '', '--None--'));
for(Schema.PicklistEntry pe : f.getPicklistValues())
{
if ( pe.getValue() != Competitors )
{
options.add( new SelectOption( pe.getValue(), pe.getLabel() ));
}
}
return options;
}
Ideas on
-why is the field not being Highlighted and marked with 'Error: You must enter a value' when I submit the form?
I am working in a similar scenario where i am using "InputField" field type. I am also giving attribute required="true", but somehow i am unable to get the RED Mark still next to the field.
The code is given below:
Can anyone please let me know why is this so? Am i missing something or is there some bug??
Any help will be really great!!
Many Thanks,
Cool_D
Do you have your <apex:inputField/> inside of an <apex:PageBlockSection> ?