Posted: 27 Feb 2017 5:43 EST Last activity: 22 Mar 2017 11:42 EDT
No Validation for Custom Filter Section in Report Definition
We are using a custom filter section in the context of a report definition rule. In this personalized section, we have two fields we wish to validate: “.StartDate” and “.EndDate”.
The “.StartDate” should not be more than 30 days before the current date and the “.EndDate” should not be more than 6 days after the current date.
In order to achieve this, we tried to test validation for one of the conditions (D+6) for this window, with the following approaches:
1. Simply add a “Change” event to the field, refresh the section all together and call an activity with a Page-Set-Messages step.
When we change the value, the message is correctly added to the associated 'Custom FIlter' clipboard page. However, upon submit, it ignores validation, no message is displayed and submission is allowed. Seems like the message has been copied (as expected, based on the pzValidateCustomFilterSection ) and is found on the next page, where the report results are displayed with the included custom filter section.
2. Adding an existing “Edit Input” rule to the property. For instance, “DateTime” :
Rule checks for Input format and blocks form submission. We get an alert sign next to the field and a pop-up message. One step closer but not exactly the condition we want to validate.
3. Adding our own personalized “Edit Input” rule to the property that checks if the value is before “Today + 6 days” and throws an InvalidValueException if not.
Nothing happens, no message, alert or blocking the submission.
4. Adding our own personalized “Validate Input” rule to the property that checks if the value is before “Today + 6 days”, throws an InvalidValueException if not and returns a Boolean.
The rule checks if the date is before Today+6, puts an alert sign + tooltip “PropertyValueInvalid” if not but doesn’t block the submission and we only get the message afterwards on the next page (report definition page).
Any idea(s) on how to work around this behavior and validate fields in this section ?
Which Pega version are you using, and are you using the default (modal) or displaying the custom section inline?
I tested with 7.2.2 using an Edit Validate on the property, and was unable to submit the modal filter window when there was a validation error. However, when the section was included inline I did observe the same issue.
I'm using Pega 7.1.9 and displaying the custom section inline.
The issue is reproduced both when the section is displayed on the report result window (when clicking "Apply Filters") and when filling fields on the filter report prompt window (first filtering before any result).
Besides, with the displayed inline section, setting required fields to empty values doesn't block submission.
Posted: 4 years ago
Posted: 1 Mar 2017 5:39 EST
Marc Alderman (Marc Alderman)
Senior Software Solutions Engineer
The inline section is no longer a requirement. We are now using the modal window and the validation does work : we get the alert logo and submission is blocked (no specific alert message displayed about this validation though)
However, we also chose to ask for filter values before accessing the report results. Thus users have to fill a filter prompt form (the custom filter section) and then submit.
In this case, our custom 'Use Validate' doesn't work : we see the alert triangle logo but no alert and submission is allowed. Please note that Validation for required fields does work here, only our validation doesn't seem to be taken into account.
After submitting, we find the validation error message on the next page :
This is the code we're using :
Any idea(s) on how to make validation work for the filter prompt form (before any report result) ?
(And, if possible, how to create an alert message within the 'Use Validate' rule (pop-up or text) ?)