Question
CGI
IN
Last activity: 29 Sep 2017 4:00 EDT
On Click of Grid Modal Cancel button, Edit Validation(s) message is not getting cleared.
Issue: On Click of Grid Modal Cancel button, Edit Validation(s) message is not getting cleared.
From a repeated grid, we are launching the Modal window to enter data by user. Some of the fields are having Edit validate.
When we have validation message on field(s) and click cancel button, Field level validation message is not getting cleared from clipboard page. Details in attached document.
Please share the solution for above issue ASAP.
Thanks in Advance!
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
CGI
IN
One more observation: Not sure anything to do with it.
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
try
{
Long.parseLong(theValue.toString());
}
catch (java.lang.NumberFormatException ex)
{
theProperty.addMessage("Enter a valid Numeric value.Max 15 charactor allowed.\t");
return false;
}
return true;
Pegasystems Inc.
US
Hi Raj,
That is actually a really good clue. Upon closer inspection of your code I see you are explicitly setting a message within the edit validate itself. Can you please try removing this as a quick diagnostic and only returning true or false accordingly?
Does it clear the message from the clipboard now?
Thanks
CGI
IN
It is displaying OOTB message. It is not getting cleared.
Thanks in Advance!
CGI
IN
Can someone help on above issue.............
Pegasystems Inc.
US
Hi Raj,
Now that is bizarre. If the OOTB rule works fine, what happens if you copy that logic/code into your rule? Is the issue still present?
How about if you copy your code into the the OOTB rule. Does the issue transfer there?
In other words, is it tied to your code, or tied to your rules?
Thanks,
Rett
CGI
IN
Hi Rett,
Below is the details of OOTB and Custom Edit validate, we see only defference is "theProperty.addMessage("Enter a valid Numeric value.Max 15 charactor allowed.\t");"
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
Hi Rett,
Below is the details of OOTB and Custom Edit validate, we see only defference is "theProperty.addMessage("Enter a valid Numeric value.Max 15 charactor allowed.\t");"
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
try
{
Long.parseLong(theValue.toString());
}
catch (java.lang.NumberFormatException ex)
{
theProperty.addMessage("Enter a valid Numeric value.Max 15 charactor allowed.\t");
return false;
}
return true;
Pegasystems Inc.
US
Hi Raj,
I'm not sure if this test was done properly or if we misunderstood each other. So the first test, if you change your custom LongNumberValidation to remove the additional explicit addMessage
try
{
Long.parseLong(theValue.toString());
}
catch (java.lang.NumberFormatException ex)
{
return false;
}
return true;
You reported the issue was still present. Is that correct?
If so, what I want you to do is private checkout or save as the OOTB NotFutureDate and put in your original code there. Does it reproduce when invoking NotFutureDate? If yes, it seems tied to this code. If no, then checkout your custom LongNumberValidation and put in the OOTB code for NotFutureDate to see what the results are.
Hi Raj,
I'm not sure if this test was done properly or if we misunderstood each other. So the first test, if you change your custom LongNumberValidation to remove the additional explicit addMessage
try
{
Long.parseLong(theValue.toString());
}
catch (java.lang.NumberFormatException ex)
{
return false;
}
return true;
You reported the issue was still present. Is that correct?
If so, what I want you to do is private checkout or save as the OOTB NotFutureDate and put in your original code there. Does it reproduce when invoking NotFutureDate? If yes, it seems tied to this code. If no, then checkout your custom LongNumberValidation and put in the OOTB code for NotFutureDate to see what the results are.
I'm not sure if you performed this secondary test as described. One of these two outcomes should help drive next steps.
Thanks,
Rett
JP Morgan Chase
IN
This is just a work around, if the above issue is still unsolved puzzle with OOTB vs Custom code.
While you are launching modal dialog window in repeating grid,
1) Utilize 'Using Page' option. Specify a temporary page. Now, you modal dialog window works on the temporary clipboard page.
2) When clicks on submit, if temporary page has no messages associated to the page, then you can copy temporary page data to your Work Object's page. If there error messages associated to temporary page, then do not copy. You may write these steps in Post activity of flow action corresponding to Modal dialog. Anyway
3) When you do cancel for whatever reasons, your modal dialog goes away and thus the errors also. If you re-launch the modal dialog , make sure you do Page-New / Page-Remove of temporary page.
If you need to retain data on temporary page (in case of abnormal close of WO), you may need to embed this temporary page to your WO.
CGI
IN
Thanks for your work around solution.
I am trying to understand the OOTB implementation to display error message. which gets cleared on click of cancel button.
Pegasystems Inc.
IN
Hello Rajasekhar,
In OOTB, I see that if the validation message is displayed on UI, then when user clicks on Cancel button (on Modal dialog), then this gets cleared. My observation is from Pega 7.2.2.
Are you launching the modal dialog from Repeating grid via action Local action or Flow in Modal Dialog?
Regards,
Rincy
CGI
IN
We are launching the modal dialog from Repeating grid via action Local action
Pega 7.2.1
CGI
IN
We are launching the modal dialog from Repeating grid via action Local action
Pega 7.2.1
CGI
IN
We are launching the modal dialog from Repeating grid via action Local action
Pega 7.2.1
CGI
IN
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
try
{
Long.parseLong(theValue.toString());
}
catch (java.lang.NumberFormatException ex)
{
theProperty.addMessage("Enter a valid Numeric value.Max 15 charactor allowed.\t");
return false;
}
return true;
CGI
IN
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
try
{
Long.parseLong(theValue.toString());
}
catch (java.lang.NumberFormatException ex)
{
theProperty.addMessage("Enter a valid Numeric value.Max 15 charactor allowed.\t");
return false;
}
return true;
Can someone guide....................
CGI
IN
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
1 When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
try
{
Long.parseLong(theValue.toString());
}
catch (java.lang.NumberFormatException ex)
{
theProperty.addMessage("Enter a valid Numeric value.Max 15 charactor allowed.\t");
return false;
}
return true;
Can someone guide....................
CGI
IN
When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
When I use OOTB Edit validate, when validation message is there on UI and click Cancel button. The validation message is cleared.
E.g.: NotFutureDate
if (theValue.trim().length() == 0) {
return false;
}
java.util.Date theDate = tools.getDateTimeUtils().parseDateTimeString(theValue);
return (theDate != null && ! theDate.after(new java.util.Date()));
2 When I use custom Edit validate, when validation message is there on UI and click Cancel button. The validation message is not cleared.
E.g.: LongNumberValidation
try
{
Long.parseLong(theValue.toString());
}
catch (java.lang.NumberFormatException ex)
{
theProperty.addMessage("Enter a valid Numeric value.Max 15 charactor allowed.\t");
return false;
}
return true;
Can someone guide....................
SiXworks Limited
GB
Hi,
You'll find that a lot of Pega OOTB Edit Validate rules have a corresponding piece of validation within a javascript file. I suspect the reason you are experiencing these issues with your Edit Validate rules and not the OOTB ones is because yours is requiring a "post" to the clipboard in order to fire.
To achieve what you are looking for, you will need to either clear down your messages explicitly on Cancel (there is an extension point activity on cancel, trace it and take a look). Alternatively you may be able to write a javascript function (not java) but I'm not well placed to give you guidance on the detail there.
Hope this helps,
Ben
Edit: The name of the OOTB javascript file has come back to me: "pega_validators.js". Use this for some guidance if you elect to use javascript. See the below article for a guide on using javascript functions!
https://pdn.pega.com/using-javascript-client-side-validation/using-javascript-client-side-validation
If you elect to clear down the messages on Cancel, be careful of the data on the clipboard. "Cancel" from a flow action modal will not revert clipboard changes made. You will find that if you have posted values on the clipboard (which you evidently have because of the error on the clipboard), then these will be kept. Again you would need to revert your changes through the extension activity on modal "Cancel"...
CGI
IN
Thanks for response.....
The approach suggested as "Cancel", is complex. I thing it is not reusable and scale able to use in entire application and in embedded pages.
https://pdn.pega.com/using-javascript-client-side-validation/using-javascript-client-side-validation. it says to use disable Auto generate check box. Which I disagree as a best practice.
I do agree Pega is using javascript, I prefer to follow the OOTB approach to implement Edit Validate. Can someone share the details.
SiXworks Limited
GB
Indeed more time consuming than just writing a javascript function; If your tech. requirement is to roll back on "Cancel" of a modal, you will need this.
That link seems misleading - Pega uses javascript anyway so I don't see a need to uncheck that checkbox.
CGI
IN
I do agree Pega is using javascript, I prefer to follow the OOTB approach to implement Edit Validate.
Can someone share the details.