Dropdown selecteditem to hide/show textboxes in the page, Dynamics NAV

CaptureIssue1.PNG

Hi team

I am trying to achieve a show textboxes in my page when selecteditem from the dropdown (Receipt Type) but I already have one for contribution (Type of Receipt) which I set visible to ContributionVisible for the textbox(Show).

That is my code below:

IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND (TypeofReceipt."No." = 'STAFF/EMP') THEN BEGIN
ContributionVisible := TRUE;
STAFF_EMPVisible := TRUE;
EE_ERContVisible := FALSE;
MGT_ERConVisible := FALSE;
PENS_ENHANVisible := FALSE;
UPFRONTVisible := FALSE;
END;

How can I add the STAFF_EMPVisible along with ContributionVisible on the textbox I want to show.

Thanks.

Not sure what you mean. Do you want to hide a column in the dropdown box?

It its hiding a field in a dropdown box depending on a variable - then it is not possible.

Or do you mean that you have a field on the page that you do a View, Properties on, and then want to have to variables STAFF_EMPVIsible AND ContributionVIsible on the the property VISIBLE - Then that is unfortunately not possible either.

You have to change the code where you create A new variable where you set that variable to true/false.

CaptureIssue.PNG

What I want to achieve is that, when i choose STAFF/EMP from the dropdown, the field called Employer Contribution should be hidden but In the Visible of the field has already ContributionVisible and when i choose MGT/ER-CON, the field called Employee Contribution should be hidden from the above page.

IF "Type of Receipt" = "Type of Receipt"::Contribution THEN BEGIN
ContributionVisible := TRUE;
SpecialFundsVsible := FALSE;
InvestmentVisible := FALSE;
RentVisible := FALSE;
ScheduleVisible := FALSE;
END;

IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND (TypeofReceipt."No." = 'STAFF/EMP') THEN BEGIN
ContributionVisible := TRUE;
STAFF_EMPVisible := TRUE;
EE_ERContVisible := FALSE;
MGT_ERConVisible := FALSE;
PENS_ENHANVisible := FALSE;
UPFRONTVisible := FALSE;
END;

CaptureIssue2.PNG

That is the field I want to show when STAFF/EMP chosen.

You could try to do a

Currpage.update(FALSE);

Just before the END-line.

But I don’t think it works!

The Visible option mostly makes sense on List Pages where you set the Visible Variable on the OnOpenPage-trigger, before the page is being openend

OnInit
ContributionVisible := FALSE;
SpecialFundsVsible := FALSE;
InvestmentVisible := FALSE;
RentVisible := FALSE;
ScheduleVisible := FALSE;

STAFF_EMPVisible := FALSE;
EE_ERContVisible := FALSE;
MGT_ERConVisible := FALSE;
PENS_ENHANVisible := FALSE;
UPFRONTVisible := FALSE;

OnOpenPage()
IF "Type of Receipt" = "Type of Receipt"::Contribution THEN BEGIN
ContributionVisible := TRUE;
SpecialFundsVsible := FALSE;
InvestmentVisible := FALSE;
RentVisible := FALSE;
ScheduleVisible := FALSE;
END;

IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND (TypeofReceipt."No." = 'STAFF/EMP') THEN BEGIN
ContributionVisible := TRUE;
STAFF_EMPVisible := TRUE;
EE_ERContVisible := FALSE;
MGT_ERConVisible := FALSE;
PENS_ENHANVisible := FALSE;
UPFRONTVisible := FALSE;
END;

OnAfterGetRecord()
IF "Type of Receipt" = "Type of Receipt"::Contribution THEN BEGIN
ContributionVisible := TRUE;
SpecialFundsVsible := FALSE;
InvestmentVisible := FALSE;
RentVisible := FALSE;
ScheduleVisible := FALSE;
END;

IF ("Type of Receipt" = "Type of Receipt"::Contribution) AND (TypeofReceipt."No." = 'STAFF/EMP') THEN BEGIN
ContributionVisible := TRUE;
STAFF_EMPVisible := TRUE;
EE_ERContVisible := FALSE;
MGT_ERConVisible := FALSE;
PENS_ENHANVisible := FALSE;
UPFRONTVisible := FALSE;
END;

That is how the code was written.

Yes and???

And I suggested you to add Currpage.Update(False) between line 38 and 39, and again between 47 and 48.

If that does not work, then you cannot get it to work, because this was not how the Visible property was intended to work.