PS: this is not duplicate all others who posted the link is not using the apex:pageBlockTable
as i appose to using in this question, the links you guys have posted are using apex:pageBlockSection
I have a page that defines an inputText
with required="true"
but when the page renders, the input box doesn't have the red bar indicating that it's required.
Tried with apex:inputField
as well.
<apex:pageBlockTable value="{!pWraps}" var="pWrap" id="pResults" rendered="{!pWraps.size>0}" >
<apex:column headerValue="Quantity" >
<apex:inputField value="{!pWrap.quantity}" required="true" />
</apex:column>
</apex:pageBlockTable>
Best Answer
This is by design. The required attribute simply makes the field required for the Ajax request.
In order to have the red mark the element needs to be the child of a pageblockscetion or sectionitem IIRC.
For example, this does display the red mark without any issue:
For other elements you may have try out the info here:
http://itsmersaini.blogspot.com/2014/11/adding-required-red-mark-on-vf-page.html
Page: testRequiredField
Basically you will have to wrap each inputField in the two divs
I have done it with jQuery / css before like this:
On document Ready:
then put the class req_blk on each input field that I wanted to mark required. There may be better ways though......
Using a PageBlockTable