Hi. Can someone tell me the steps to apply validation message to the save button? I want provide a validation message when user click on save. It’s bit urgent. Thanks in advance.
Best answer by Giri K
View originalHi. Can someone tell me the steps to apply validation message to the save button? I want provide a validation message when user click on save. It’s bit urgent. Thanks in advance.
Best answer by Giri K
View original
In RowPersistingEvent of Header Table you can give Validation.
In RowPersistingEvent of Header Table you can give Validation.
How to access this RowPersistingEvent ? Do i have to override a method called RowPersistingEvent? In override methods there wasn’t method as such. Therefore should i just write it in my code like this?
public void SOOrder_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseHandler)
{
baseHandler?.Invoke(cache, e);
ARInvoice row = Base.Document.Current;
throw new PXSetPropertyException("Your custom validation.", PXErrorLevel.Error);
}
public void SOOrder_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseHandler)
{
baseHandler?.Invoke(cache, e);
//your validation
--------------------
--------------------
}
public void SOOrder_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseHandler)
{
baseHandler?.Invoke(cache, e);
//your validation
--------------------
--------------------
}
It just saves without giving me any validation. I took this code from chatgpt. Can you provide me a proper code to make this work ?
This is the code i used.
public void SOOrder_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseHandler)
{
baseHandler?.Invoke(cache, e);
//your validation
throw new PXException("my validation");
}
I am working on Sales Order Invoice Screen.
Try this
public void ARInvoice_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseHandler)
{
if (baseHandler!= null)
baseHandler(cache, e);
//your validation
throw new PXException("my validation");
}
Try this
public void ARInvoice_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseHandler)
{
if (baseHandler!= null)
baseHandler(cache, e);
//your validation
throw new PXException("my validation");
}
Thank you so much it’s working now.
hi
So i used a confirmation message box on save. If user click yes then i want to proceed with save. If user select ‘no’ i want avoid saving. I get this error when i select no. “Error: Key field cannot start with a leading space.”
Here’s my code. How can i fix it ?
public void ARInvoice_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseHandler)
{
if (baseHandler!= null)
baseHandler(cache, e);
WebDialogResult result = Base.Document.Ask("Confirmation", "Do you want to remove the hold?", MessageButtons.YesNo);
if (result == WebDialogResult.No)
{
e.Cancel = true; // User clicked "No" in the confirmation dialog, cancel the save operation
}
}
you can write below code in NO condition
throw new PXException(“Save Cancelled”)
you can write below code in NO condition
throw new PXException(“Save Cancelled”)
Hi
Thank you. It solved my issue.
hi
So i used a confirmation message box on save. If user click yes then i want to proceed with save. If user select ‘no’ i want avoid saving. I get this error when i select no. “Error: Key field cannot start with a leading space.”
Here’s my code. How can i fix it ?
public void ARInvoice_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseHandler)
{
if (baseHandler!= null)
baseHandler(cache, e);
WebDialogResult result = Base.Document.Ask("Confirmation", "Do you want to remove the hold?", MessageButtons.YesNo);
if (result == WebDialogResult.No)
{
e.Cancel = true; // User clicked "No" in the confirmation dialog, cancel the save operation
}
}
hi
So this method triggers on remove hold button as well. How can i make it work only for the save button ?
hi
So this method triggers on remove hold button as well. How can i make it work only for the save button ?
This happens after i save the record only. Before saving everything works fine but once i save, the confirmation message which i wrote for the save button occurs on remove hold button as well. How can i stop this and make it happen only at the save button ?
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.