This topic is locked

Inline Add With Values On The Fly

1/10/2013 9:02:39 AM
PHPRunner General questions
S
sickacid author

Hi! I've supplier_table with some paramters example weight (flag 0/1) and another table (orders_table) with inline add

Some supplier is weight enabled other not.
So, I want to do something like this:
I want to add an order, the first field is lookup wizard on database talbe (supplier_table), and after there is a field named weight but should be enabled or disabled according to the supplier who choose. so this field should bhe change dinamically when i change supplier_id
javascript is easy to do i can use on.change function but how can I get de right value (flag 0 or 1) of field weight from table supplier_table?
I've done this but it works only when the page is loaded first time ant isn't dynamic <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=20514&image=1&table=forumtopics' class='bbc_emoticon' alt=':unsure:' />

in (ADD)process record values:
$FO = $values['IdTipoMerce'];

$sql = "select * from anagraficafornitori where IDFornitore='".$FO."'"; //get id_supplier

$rs = CustomQuery($sql);

$dataarticle = db_fetch_array($rs);

$pageObject->setProxyValue("GRK", $dataarticle["Gestione_riporta_Kg"]); //get value of flag
ON JS event:
var TS = Runner.getControl(pageid, 'IdTipoMerce'); //id_supplier

var PP = Runner.getControl(pageid, 'IdPreparatore'); //field to hide or not
TS.on('change', function(e)

{

if(proxy.GRK == '1')

{

PP.setEnabled();

}

else

{

PP.setDisabled();

}

});

C
cgphp 1/10/2013

You can use two dependent dropdowns, one for TipoMerce and one for anagraficafornitori (more info here http://xlinesoft.com/phprunner/docs/lookup_wizard.htm#depend_drop_box), or, anytime IdTipoMerce field changes, you can make an AJAX call that returns 0 or 1 (this solution requires some custom code. More info here: http://api.jquery.com/jQuery.ajax/).

S
sickacid author 1/11/2013



You can use two dependent dropdowns, one for TipoMerce and one for anagraficafornitori (more info here http://xlinesoft.com/phprunner/docs/lookup_wizard.htm#depend_drop_box), or, anytime IdTipoMerce field changes, you can make an AJAX call that returns 0 or 1 (this solution requires some custom code. More info here: http://api.jquery.com/jQuery.ajax/).


TipoMerce (field of orders_table) is only a filter for anagraficafornitori it contains the id of anagraficafornitori enabled to place orders, but with php i create an array, java isn't unable to search the correct value in the array?
Can I do sth like this?
$FO = 1;

$sql = "select * from anagraficafornitori where GestioneTransitPoint='".$FO."'"; //Filter for enabled supplier

$rs = CustomQuery($sql);

$dataarticle = db_fetch_array($rs);

$pageObject->setProxyValue("GRK", $dataarticle["Gestione_riporta_Kg"]); //flag 1/0

$pageObject->setProxyValue("IDF", $dataarticle["IDFornitore"]); //id of supplier