Jan 23, 2015, 7:48 AM
93 Posts
topic has been resolvedResolved

Bootstrap Validation

  • Category: Other
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 2

Hi guys,


Im using the re-usable forms and validation snippet from Mark Leusink (http://www.bootstrap4xpages.com/bs4xp/demos.nsf/reusableFields.xsp) which I think is brilliant.

Im having an issue with it however....

When validating, all the error message's all say the same.

ie I have a field called name and a field called address

Both fields show error text on page load (name is required, address is required)

Firstly, I dont want these to show until I hit the save button, I only want to show the messages when the fields are blank on save.

Secondly, when I save, both fields validate and turn red etc so are working as they should, however the address validation message changes and both validation messages now say name is required….

Basically, if I have 10 fields on my xpage, the validation message for all of them is the same, not specific to each field (And yes I have set the custom property help text to be different for each custom control)

*Edit: Just noticed the help text is correct for all fields, until I save the document, then when the validation fails and the fields turn red, it is at this point that all the error messages change to be the same....*

Im a little lost as to what Im doing wrong on both cases above so any pointers would be much appreciated.



Jan 23, 2015, 9:30 AM
93 Posts
2nd part solved

The validation text now updates correctly....


I built my own version of the reusable text control and validators to work with the select2 stuff so I could pass in lookup values and style as it doesnt work out of the box, however I did not change references from inputText1 to comboBox1.


i then received value required default message and realised I had also no included the custom validator code.


So all that is left now, is to make the validation text only show when saving a document and not at the start when creating a document.....

Jan 23, 2015, 9:51 AM
93 Posts
1st part solved

Solved :- )

Pay attention to the bold areas in the 2 blocks of code below..


                            message="#{javascript:compositeData.fieldLabel + ' is required'}">


<xp:text escape="true" id="computedField1"

                styleClass="help-block" value="${compositeData.helpText}">
                <xp:this.rendered><![CDATA[#{javascript:getComponent("inputText1").isValid() && compositeData.helpText != null && currentDocument.isEditable()}]]></xp:this.rendered>


Changed to this...




<xp:text escape="true" id="computedField1"
                styleClass="help-block" *Deleted*>
                <xp:this.rendered><![CDATA[#{javascript:getComponent("inputTextarea1").isValid() && compositeData.helpText != null && currentDocument.isEditable()}]]></xp:this.rendered>