Not able to make the system force entring required fields by the user on Dialog
I have added a custome dialog to AP Bills. What I would like to happen is to force user to enter an “Assignee”. I have set the DAC to validate null values. in my dialog screen it shows * by the field but when user clicks on OK button, even if this field is not entered the dialog continues while it should raise an error that this fieled is not entered. below is my partial DAC:
protected virtual void DACNAME_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if (DailogboxView.Current.USRAssingee!= null) {
DailogboxOK.SetEnabled(true); }
}
Hope this helps.
Thanks @praveenpo the NullOrBlank will make difference on String fields only while mine is numeric.
thanks @deebhane I will test this but I believe there should be a better option as well. I have seen this validations on smart panels like as “Reasons” dialog that works without disabling buttons but validating values.
I have achieved this with JS on panel but I know it is not standard way of Acumatica neither disability ok button. I’m looking for something that meets Acumatica’s coding standards.
any other thoughts?
@deebhane i tried this and didn’t work.
hi @aaghaei,
I believe this can achieved with out JS as well, as you indicated the approach I have suggested you, you have seen similar way of implementation in acumatica standard as well, this can be one of approach as well.
Since you have indicated you have achieved this via JS, in case you like to implement the approach suggest please confirm the below
Please confirm, did row selected event trigger when popup ok button is clicked.
Is “Ok” button disabled while the popup is opened?
if yes, can you please share your code snippet of the row selected event.
Hi @deebhane
Even though the OK button enabled is set to false and when panel is loaded the “Owner” is null, it always is loaded as enabled.
here is my View/Select;
public PXFilter<EPRoutingPanelDialog> RoutingPanelDialog;
here is my rowselected event handler:
protected virtual void EPRoutingPanelDialog_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler) { if (RoutingPanelDialog.Current.Owner != null) { ChangeOk.SetEnabled(true); } }
Thank you very much @deebhane. manupulating from the main DAC worked for my purpose. Here I have attached my revised event handler for reference. though, I have another question. When I was manupulating the fields through the panel DAC, my cache was the panel data. Now my cache data is APInvoice data. I was wondering is it possible to enable/disable the fields on the smart panel from the main DAC or I have to keep them in the smart panel DAC. In the below code what should I use instead of “cache” to disable “Step” field on the panel conditionally from the main DAC?