This topic is locked

Dropdown on Add page to hide fields based on selected row

1/17/2025 11:36:06 AM
PHPRunner General questions
A
asawyer13 authorDevClub member

I want to essentially do this but once the value in the dropdown is selected there are fields in that record that indicate which fields I should hide.

For example, for Item 1, maybe FromDate and ThruDate should be hidden but not CompanyID.

So the record looks like
record id = 1
description = Company listing
ShowFromDate = No
ShowThruDate = No
Show CompanyID = Yes

So once they select Company LIsting from the dropdown, the two date fields should be hidden and only the company Id field should be shown.

Does that make sense?

Alan

A
asawyer13 authorDevClub member 1/17/2025

I think I can figure this out myself. I apologize for posting before I tried some things myself.

I'll keep it open for now, but I think I can figure it out. I will mark it as solved once I get it working.

Alan

C
copper21 1/17/2025

Add this code to Javascript - Add Page

Not sure what exactly your field names are, so you might have to change that. You are going to have to correspond the itemid's on the add page in designer mode.

var Discription = Runner.getControl(pageid, 'Description');
var SFD = Runner.getControl(pageid, 'ShowFromDate');
var STD = Runner.getControl(pageid, 'ShowThruDate');

Discription.on('change', function(){
if (this.getValue() == 'Company Listing'){
pageObj.hideField('ShowFromDate');
pageObj.hideField('ShowThruDate');
}
else {
pageObj.showField('ShowFromDate');
pageObj.showField('ShowThruDate');
} });