Solved

How to prevent dialog from closing when mandatory fields are not filled.

  • 26 January 2022
  • 4 replies
  • 150 views

Userlevel 7
Badge +9

Hello,

I have added a dialog to Bills and Adjustments Screen to be able to route the documents to an assignee. See below snip:

 

I have made the “Assignee” Required. As you can see the DAC is set to force the user to enter the assignee. Here is the DAC:

#region Owner

public abstract class owner : PX.Data.BQL.BqlInt.Field<owner> { }

[Owner(PersistingCheck = PXPersistingCheck.Null, DisplayName = "Assignee", Required = true, ValidateValue = true)]

public virtual Int32? Owner { get; set; }

#endregion

 

  1. What I would like to happen is to keep this dialog open if “Assignee” is null or invalid and user clicks OK but dialog gets closed. I tried to force this by field selecting/verifying but I didn’t have any luck. How can I manage this?
  2. Is the anyway to remove the close button (X) from top of the dialog and disable the ESC key on it?
icon

Best answer by aaghaei 6 March 2022, 04:58

View original

4 replies

Userlevel 7
Badge +17

Thanks, @aaghaei  for sharing with us. This helps us a lot.

Userlevel 7
Badge +9

@Naveen B here is what I have done as refernce.

1) assign a function name to the dialog property ClientEvents-AfterShow="removeCloseButton" in my example as follows

<px:PXSmartPanel runat="server" ID="pnlOpenDialogBox" AutoReload="True" ShowAfterLoad="True" CaptionVisible="True" Caption="Routing Panel" Key="RoutingPanelDialog" AcceptButtonID="cbOk" CancelButtonID="cbCancel" AutoCallBack-Target="formOpenDialogBox" AutoCallBack-Command="Refresh" ClientEvents-AfterShow="removeCloseButton" CloseButtonDialogResult="No">

2) write a simple JS with the same function name assigned above addressing the dialog element in my example as follows

<px:PXJavaScript runat="server" ID="jsRoutingPanelDialog" IsStartupScript="False" Script="function removeCloseButton() {document.getElementById('ctl00_phG_pnlOpenDialogBox_cap').children[0].style.display='none';}"

3) publish your customization and “X” is removed as shown below.

 

Userlevel 7
Badge +17

Hi @aaghaei  Can you please share the solution here for reference.

Userlevel 7
Badge +9

I removed the “X” using JS.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved