This topic is locked
[SOLVED]

 Hide multiple rows on value selected from dowpdown list

1/25/2014 1:56:39 AM
PHPRunner General questions
J
jianwong author

Hi Guys
I hope someone could give me some pointers or sample code on how to hide multiple rows on selection of a various values from a dropdown list.
For example, in the dropdown list there are value1, value2, value3, value4 and value5. When either value3, value4 or value5 is selected, same number of rows that include label and field on the Add/Edit page will hide.
I used the following method, but it only to hide one row on one value selection. I appreciate it if someone could help me on this.

============

  1. on html page, add 'id=penthouserow' to 'penthouse' column.
  2. add the following script on JavaScript Onload on Event tab:
    // hide penthouse type=Industrial

    var ctrlType = Runner.getControl(pageid, 'types');

    //target row to appear / disappear

    var penthouserow = document.getElementById("penthouserow");

    ctrlType.on('change', function(e){

    if (this.getValue() == 'Industrial')

    {

    penthouserow.style.display = 'none';

    }else{

    penthouserow.style.display = ''; }

    }

    );



J
jianwong author 2/10/2014

Hi
Could anyone share about how to hide desired rows (label & field) when a value from a dropdown list is selected?
I used the following script on JavaScript onload to hide rows when a value 'Office' is selected from a dropdown list field named 'types'. However, if I wanted to hide the same rows when another value, let's say 'Retail', is selected from the same dropdown list. How do I change the syntax to achieve this task?
I appreciate if anyone can guild me on this.

============

// dropdown control

var ctrlType = Runner.getControl(pageid, 'types');

//target row to appear / disappear

var features1row = document.getElementById("features1row");

var features1row01 = document.getElementById("features1row01");

var features1row02 = document.getElementById("features1row02");

ctrlType.on('change', function(e){

if (this.getValue() == 'Office')

{

//ctrlrows.hide();

features1row.style.display = 'none';

features1row01.style.display = 'none';

features1row02.style.display = 'none';

//ctrlrows.show();

features1row.style.display = '';

features1row01.style.display = '';

features1row02.style.display = '';

}

}

);