This topic is locked
[SOLVED]

 Show/hide Checkbox by checkbox Java

7/13/2012 4:49:29 AM
PHPRunner General questions
S
sickacid author

Hi I want to create a depending checkbox in java in add/edit page. If i check TS, NA ad KG must be enabled, and if I uncheck TS, NA and KG must be disabled. This code doesn't work <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=19844&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />, when i load the page TS is unchecked and i see NA and KG ad enabled. Any suggestion? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=19844&image=2&table=forumtopics' class='bbc_emoticon' alt=':(' />
var TS = Runner.getControl(pageid, 'GestioneTransitPoint');

var NA = Runner.getControl(pageid, 'Gestione_numerazione_automatica');

var KG = Runner.getControl(pageid, 'Gestione_riporta_Kg');
TS.on('change', function(e){

if (this.getValue() == '1')
{

KG.setEnabled(); //disabilita il controllo

NA.setEnabled(); //disabilita il controllo

}

else

{

KG.setDisabled();

NA.setDisabled();

};

});

C
cgphp 7/13/2012

Use the click event for checkboxes. Check this article to know how to get the value of a checkbox: http://xlinesoft.com/phprunner/docs/ctrl_getvalue.htm

S
sickacid author 7/13/2012



Use the click event for checkboxes. Check this article to know how to get the value of a checkbox: http://xlinesoft.com/phprunner/docs/ctrl_getvalue.htm


I've fixed the code and works, but when the page is refreshed, all the checkbox is set as Enabled <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=67029&image=1&table=forumreplies' class='bbc_emoticon' alt=':o' />
var TS = Runner.getControl(pageid, 'GestioneTransitPoint');

var NA = Runner.getControl(pageid, 'Gestione_numerazione_automatica');

var KG = Runner.getControl(pageid, 'Gestione_riporta_Kg');
TS.on('click', function(e){

if (this.getValue() == 'on')
{

KG.setEnabled(); //disabilita il controllo

NA.setEnabled(); //disabilita il controllo

}

else

{

KG.setDisabled();

NA.setDisabled();

};

});

S
sickacid author 7/13/2012



I've fixed the code and works, but when the page is refreshed, all the checkbox is set as Enabled <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=67030&image=1&table=forumreplies' class='bbc_emoticon' alt=':o' />
var TS = Runner.getControl(pageid, 'GestioneTransitPoint');

var NA = Runner.getControl(pageid, 'Gestione_numerazione_automatica');

var KG = Runner.getControl(pageid, 'Gestione_riporta_Kg');
TS.on('click', function(e){

if (this.getValue() == 'on')
{

KG.setEnabled(); //disabilita il controllo

NA.setEnabled(); //disabilita il controllo

}

else

{

KG.setDisabled();

NA.setDisabled();

};

});


I've do this:

var TS = Runner.getControl(pageid, 'GestioneTransitPoint');

var NA = Runner.getControl(pageid, 'Gestione_numerazione_automatica');

var KG = Runner.getControl(pageid, 'Gestione_riporta_Kg');
if (TS.getValue()=='on')

{

KG.setEnabled(); //disabilita il controllo

NA.setEnabled(); //disabilita il controllo

}

else

{

KG.setDisabled();

NA.setDisabled();

};
TS.on('click', function(e){

if (this.getValue() == 'on')
{

KG.setEnabled(); //disabilita il controllo

NA.setEnabled(); //disabilita il controllo

}

else

{

KG.setDisabled();

NA.setDisabled();

};

});