I have an XPage which is divided into several Dojo content panes. I use Client side JavaScript to decide which Dojo content pane is displayed. I now want to add validation for several required fields to the XPage. However, for both client side and server side validation, the document is prevented from saving but if the field requiring validation is in a Dojo content pane other than the Dojo content pane currently being displayed, the user does not get to see the server side error message and the cursor is not placed in the field which has failed validation (the client side message is visible but again the cursor is not placed in the field which has failed validation). Is there any way I can add CSJS code to be executed when a field fails validation? (ideally I would like to use server side validation only)
Here is a field requiring validation
<xp:inputText id="FirstName" value="#{document1.FirstName}" required="true">
<xp:this.validators>
<xp:validateRequired>
<xp:this.message><![CDATA["REQUIRED"]]></xp:this.message>
</xp:validateRequired>
<xp:validateLength minimum="5" maximum="10">
<xp:this.message><![CDATA["VALIDATE"]]></xp:this.message>
</xp:validateLength>
</xp:this.validators>
</xp:inputText>
Here the code for a Dojo content pane
<xe:djContentPane id="Employee">
Here CSJS code to show or hide a Dojo content pane
var Allgemein = dojo.byId("#{id:Allgemein}");
if (sectionDisplay == "Allgemein") {
dojo.style(Allgemein, "display", "block");
} else {
dojo.style(Allgemein, "display", "none");
}
var sectionDisplay = dojo.cookie("sectionDisplay");
<xp:inputText id="FirstName" value="#{document1.FirstName}" required="true"> <xp:this.validators> <xp:validateRequired> <xp:this.message><![CDATA["REQUIRED"]]></xp:this.message> </xp:validateRequired> <xp:validateLength minimum="5" maximum="10"> <xp:this.message><![CDATA["VALIDATE"]]></xp:this.message> </xp:validateLength> </xp:this.validators> </xp:inputText>
here the code for a dojo content pane<xe:djContentPane id="Employee">
- user1358852var Allgemein = dojo.byId("#{id:Allgemein}"); if (sectionDisplay == "Allgemein") { dojo.style(Allgemein, "display", "block");} else { dojo.style(Allgemein, "display", "none"); } var sectionDisplay = dojo.cookie("sectionDisplay");
- user1358852