This topic is locked

How to hide or display a cell row depending on 'radio button'?

5/11/2010 1:30:35 PM
PHPRunner General questions
N
Nelson author

Hi,
I know how to hide or display rows depending on the 'dropdowns' options!

<script>

//hide all rows

document.getElementById("hidediv1").style.display="none";

document.getElementById("hidediv2").style.display="none";
document.forms.editform1.value_Category_1.onchange=function()

{

if(this.options[this.selectedIndex].value=='Cars')

{

document.getElementById("hidediv1").style.display="table-row";

}

else

{

document.getElementById("hidediv1").style.display="none";

}

if(this.options[this.selectedIndex].value=='Houses')

{

document.getElementById("hidediv2").style.display="table-row";

}

else

{

document.getElementById("hidediv2").style.display="none";

}

}

</SCRIPT>


My question is how to do the same depending on the options chosen on a 'radio button'
I guess I have to change this part?

document.forms.editform1.value_Category_1.onchange=function()


Thanks

Nelson

A
ann 5/12/2010

Nelson,
to hide/display rows depending on "radio button" use controls of JavaScript API.

Here is a sample:

var recCtrlsArr =Runner.controls.ControlManager.getAt('TableName');

recCtrlsArr[0].on('change',function(e){

if (this.getValue()==Value)

{

...

}

else

{

...

}})


For more information:

http://xlinesoft.com/phprunner/docs/javascript_api.htm

N
Nelson author 5/16/2010



Nelson,
to hide/display rows depending on "radio button" use controls of JavaScript API.

Here is a sample:

var recCtrlsArr =Runner.controls.ControlManager.getAt('TableName');

recCtrlsArr[0].on('change',function(e){

if (this.getValue()==Value)

{

...

}

else

{

...

}})


For more information:

http://xlinesoft.com/phprunner/docs/javascript_api.htm


Hi Ann,

I've tried but it seems I can't make this one work
My Table's name is : anunciar

The radio button name is: Anunciar como

There are two options to choose from on this radio button: 'pessoal' and 'empresa'
what I wanted to do was depending on which option on the radion button was chosen...a row would get displayed or hidden...I can't figure it out...could you help me?
Thanks

Nelson

A
ann 5/17/2010

Nelson,
here is a sample:

var recCtrlsArr =Runner.controls.ControlManager.getAt('anunciar');

recCtrlsArr[0].on('change',function(e){

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

{

document.getElementById("hidediv1").style.display="none";

document.getElementById("hidediv2").style.display="table-row";

}

else

{

document.getElementById("hidediv1").style.display="table-row";

document.getElementById("hidediv2").style.display="none";

}})


If it doesn't help please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.