This topic is locked

Customized add page based on dropdown select

7/27/2012 4:45:09 AM
PHPRunner General questions
S
sickacid author

Hi..

How can I own customize an add page by dropdown select with values from another table?
For example, I use this code in Java for enable or disable some fields
if ( (this.getValue() == '20') || (this.getValue() == '24') )

{

NS.setEnabled(); //disabilita il controllo

CT.setDisabled(); //disabilita il controllo

IF.setDisabled(); //disabilita il controllo

}

});
and it works fine!

But now i want to add in another table some sets by checkbox to enable or disable some fields in this add page, and the page must change based on the ID I select, for example if i select ID 20 the page change some sets and if i select another ID, another sets. How can I load the sets in Java?

S
sickacid author 7/28/2012

I've put a snippet in add page:
$sql="select * from anagraficaattrezzature where Id=".$values["Tipo_disposivito"];

$rs=CustomQuery($sql);

$dataarticle=db_fetch_array($rs);

echo "<script>var REVI='" . $dataarticle["revisionabile"] . "';</script>";
and in JS on load
I've used a simply if statement to check REVI value, but it doesen't works <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=67178&image=1&table=forumreplies' class='bbc_emoticon' alt=':unsure:' />
var TD = Runner.getControl(pageid, 'Tipo_dispositivo');
TD.on('change', function(e)

{

if (REVI=='1')

{

CT.setEnabled(); //disabilita il controllo

}

else

{

CT.setDisabled(); //disabilita il controllo

}
});

S
sickacid author 7/30/2012



Check this article: http://xlinesoft.com/phprunner/docs/how_to_access_php_variables.htm


Is not very clear. I need to reload REVI value(through MYSQL query) when I change a value in the drop down.

C
cgphp 7/30/2012

In the "Process record values" event of Add page, enter the following code:



$sql = "select * from anagraficaattrezzature where Id=".$values["Tipo_disposivito"];

$rs = CustomQuery($sql);

$dataarticle = db_fetch_array($rs);

$pageObject->setProxyValue("REVI", $dataarticle["revisionabile"]);


In the "JS onload" event, enter the following code:

var TD = Runner.getControl(pageid, 'Tipo_dispositivo');
TD.on('change', function(e)

{

if(proxy.REVI == '1')

{

CT.setEnabled();

}

else

{

CT.setDisabled();

}

});
S
sickacid author 7/30/2012



In the "Process record values" event of Add page, enter the following code:



$sql = "select * from anagraficaattrezzature where Id=".$values["Tipo_disposivito"];

$rs = CustomQuery($sql);

$dataarticle = db_fetch_array($rs);

$pageObject->setProxyValue("REVI", $dataarticle["revisionabile"]);


In the "JS onload" event, enter the following code:

var TD = Runner.getControl(pageid, 'Tipo_dispositivo');
TD.on('change', function(e)

{

if(proxy.REVI == '1')

{

CT.setEnabled();

}

else

{

CT.setDisabled();

}

});



It don't works... if I insert the php code add new button won't works <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=67198&image=1&table=forumreplies' class='bbc_emoticon' alt=':unsure:' /> . Maybe beacuse this page under a master table? have I to use $dal in Process record values?