Skip to main content
Answer

How to show/Hide a section of a form based on another form field (Check box) value?

  • December 7, 2021
  • 5 replies
  • 666 views

Forum|alt.badge.img+1

Hi, I am new to Acumatica, I want to show or hide some section based on the check box value which is available in another form. How to achieve this functionality. Could you please assist on this.

Best answer by vivekm

Hi @MoulaliShaik79 

You can try like below using RowSelected event:

 protected virtual void InventoryItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected BaseEvent)
        {
            if (BaseEvent != null) BaseEvent(cache, e);
            InventoryItem rows = (InventoryItem)e.Row;
            if (rows == null) return;
            if (rows.checkbox == false) // If your checkbox unchecked
            {
                View.AllowSelect = false; // whole section will be hidden, if that section has specific view
                PXUIFieldAttribute.SetVisible<KNDCInventoryItemExt.usrKNDCBaseNewConditionSKU>(cache, rows, false); // specific field will be hidden
            }
        }

5 replies

vivekm
Varsity II
Forum|alt.badge.img
  • Varsity II
  • Answer
  • December 7, 2021

Hi @MoulaliShaik79 

You can try like below using RowSelected event:

 protected virtual void InventoryItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected BaseEvent)
        {
            if (BaseEvent != null) BaseEvent(cache, e);
            InventoryItem rows = (InventoryItem)e.Row;
            if (rows == null) return;
            if (rows.checkbox == false) // If your checkbox unchecked
            {
                View.AllowSelect = false; // whole section will be hidden, if that section has specific view
                PXUIFieldAttribute.SetVisible<KNDCInventoryItemExt.usrKNDCBaseNewConditionSKU>(cache, rows, false); // specific field will be hidden
            }
        }


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • December 7, 2021

Hi @MoulaliShaik79  Please find the code sample below.

 

  protected virtual void DACName_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
DACName row = e.Row as DACName;
if (row != null)
{
if (row.Checkboxvalue == true)
{
ViewName.AllowSelect = false;
}
else
{
ViewName.AllowSelect = true;
}
}
}

 


Forum|alt.badge.img+1
  • Author
  • Semi-Pro II
  • December 7, 2021

Thanks a lot both of you.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • December 7, 2021

@MoulaliShaik79  Hope you have done with your requirement


Forum|alt.badge.img+1
  • Author
  • Semi-Pro II
  • December 15, 2021

@MoulaliShaik79  Hope you have done with your requirement

@Naveen B, Yes, I did it.