Question

Custom control and validation messages

Problem:

I have need to create a custom control and I need to know how to display the standard validation messaging with it when it fails validation.

Details:

I had this in my notes from version 6.x years ago but it doesn't work properly in newer versions (currently on 7.4). I suspect it was replaced by something different but I cannot find any stream rule by the name Messages.

<pega:include name="Messages"/>

It renders almost entirely off-screen (or at least off-layout) except a couple pixels of the icon which is below the field and rendered over the next field's label. The validation text is entirely not rendered. Shown here is Customer name which is an OOTB control for reference, Account Number (DDA) which is the custom control with the issue, and Card Number to illustrate the issue with rendering.

Here's the snippet of code from the control where this occurs.

  1. <SPAN nowrap>
  2. <input
  3. <pega:include name="Attributes" />
  4. <pega:include name="ClientValidation"/>
  5. id="myFieldID"
  6. type=text
  7. data-ctl='["TextInput"]'
  8. />
  9. <pega:include name="Messages"/>
  10. </SPAN>

***Edited by Moderator Marissa to update platform capability tags****

Comments

Keep up to date on this post and subscribe to comments

October 9, 2019 - 10:24am

There's another post that technically works, at least as of Pega 7.4, but it hard-codes some CSS class references so would be best to avoid. Specifically I'm looking for whatever hidden rule replaced Messages from the include tag (which is hidden).

<pega:include name="Messages"/>

 

https://community1.pega.com/community/pega-product-support/question/property-message-display-custom-control

Pega
October 9, 2019 - 2:25pm

I was able to simply use this and get the desired effect.

    <SPAN nowrap>
        <input
            id="myFieldID"
            type="text"
            data-ctl="["TextInput"]"
            validationtype="required"
        >
    </SPAN>