Skip to main content
Solved

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

  • January 26, 2022
  • 4 replies
  • 173 views

aaghaei
Captain II
Forum|alt.badge.img+10

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?

Best answer by aaghaei

I removed the “X” using JS.

View original
Did this topic help you find an answer to your question?

4 replies

aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • 1203 replies
  • Answer
  • March 6, 2022

I removed the “X” using JS.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3407 replies
  • March 6, 2022

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


aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • 1203 replies
  • March 6, 2022

@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.

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3407 replies
  • March 6, 2022

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings