You need to sign in to do that
Don't have an account?
Rohan Sureshkumar
Apex Input Field label attribute not working
This is my code:
<apex:inputField label="Week" value="{! hours_worked__c.pick_a_sunday__c}" id="datepicker" showDatePicker="false"/>
I don't get any label in the output just an input box. Please suggest a solution
<apex:inputField label="Week" value="{! hours_worked__c.pick_a_sunday__c}" id="datepicker" showDatePicker="false"/>
I don't get any label in the output just an input box. Please suggest a solution
Is this field in an <apex:pageBlockSectionItem> ? Is so, it's normal, if you include an <apex:outputField> or an <apex:inputField> component in an <apex:pageBlockSectionItem>, these components do not display with their label or custom help text as they do when they are children of an <apex:pageBlockSectionItem>.
Find out more here: http://www.salesforce.com/docs/developer/pages/Content/pages_compref_pageBlockSectionItem.htm (http://www.salesforce.com/docs/developer/pages/Content/pages_compref_pageBlockSectionItem.htm" target="_blank)
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
<apex:pageBlockSectionItem>? They are the same thing right?
No difference at all, if it's in so it is a child.
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
Indeed! That part is in Salesforce documentation from the link that I provided and surely sounds very confusing. You should ignore this part:
"as they do when they are children of an <apex:pageBlockSectionItem>". Hope to have clarified.
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
It seems that the problem was caused due to <apex:inputField> not being a direct child of <apex:pageBlockSection>. The <apex:form > tag was nested in between. I have changed the heirarchy:
<apex:form >
<apex:pageBlock title="Sample">
<apex:pageBlockSection columns="1">
<apex:inputField label="Week (select the Sunday):" value="{! hours_worked__c.pick_a_sunday__c}" id="datepicker" showDatePicker="false"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form >
And it works - the label is displayed.
Thanks for your help, Zuinglio