Making a read only field be required Added by ~Martha Refanater on August 26, 2011 | Version 1
|
|
ShowTable of Contents
Validating a Read Only field
By default a field set to be
read only cannot be required, but with a little help from my friend
Chris Toohey you can add a div tag with a style to make it work like
shown below: <div style="display: none;">
<xp:inputText
id="rptToName1"
value="#{xp_record.RptToName}"
required="#{javascript:return submittedBy( 'questionairreBtn1' )}" styleClass="tableCellLabelLeftNormal">
<xp:this.validators>
<xp:validateRequired message="Who this position reports to is required"></xp:validateRequired>
</xp:this.validators> </xp:inputText>
</div>
The
field property should have read only deselected and the visible
property can be either or, then you create a visible computed field that
uses the value of the now hidden control which is required and
magically it works like a charm. I have also submitted this idea - xPages Required Property - on IdeaJam about this Dwain A Wuerfel
|