This topic is locked

show/hide field on new/edit page depending on another field value

4/6/2023 7:51:35 AM
PHPRunner General questions
P
pmuckle authorDevClub member

Hi All,
I have a radio button with options 1-6, with a multi-select checkbox that I want to show when 2-4 are selected, and hidden when 1, 5 or 6 are selected. If option 1 is selected, the checkboxes are cleared (this is fine as it is).
I am using this code from an earlier post, which shows/hides and clears the multi-select depending on whether value <> 1. I'm trying to add in values 5 and 6 to the if statement here.
var ctrlHideMe = Runner.getControl(pageid, 'radio_value');
ctrlHideMe.on('change', function(e) {
if (this.getValue()!=='1'){
pageObj.showField("mulit-select");
} else {
pageObj.hideField("multi-select");
}
The second thing is to show/hide the multi-select when opening in edit (ie reads the value and sets the show/hide), I'm not sure what code to use or where to put it?
Thanks for any help
Pete

fhumanes 4/9/2023

Hi Pete,
I think the information you are looking for is explained in this article. https://fhumanes.com/blog/guias-desarrollo/guia-1-para-noveles-en-phprunner/
Greetings,
fernando

P
pmuckle authorDevClub member 4/11/2023

Thank you Fernando