This topic is locked

Force a Control to be Recognised as Changed

8/31/2016 4:05:31 PM
PHPRunner General questions
D
dangdk author

Hi,
I have a Master add/edit page with the child contents added inline. I need to change one of the dropdown fields in the inline child rows based on a change in a dropdown field in the master. I do this as suggested on this forum:
var ctrl = Runner.getControl(pageid, 'masterSupplier');

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

$("[id^=value_childSupplier]").val(this.getValue());

window.Supplier = this.getValue();

});
However, while this changes the field it does not recognise it as being changed. This is important as several lookup fields are dependent on it and they do not currently update when this child field is changed by the javascript.
I have the idea to set a window variable in the master page and then check for a change in this in the child page javascript and if it has changed then force set the control as being changed, as below:
setInterval(function() {
if(window.Supplier !== null && window.Supplier !== old) {

alert(window.Supplier);
CtrlSupplier.dispatchEvent(new Event('change'));

};

old = window.Supplier;

}, 1000);
I get the alert on changing the master field but the control does not get changed. If I explicitly name the id, as below, it works, but this is no good as I need it to work for multi-line rows of children.
var saveData = document.getElementById("value_Supplier_8");

...

saveData.dispatchEvent(new Event('change'));
Also, is there a way I can force-set the Supplier field in the child to be that of the master when I add a new child inline?
Thanks

D
dangdk author 9/23/2016

1288 views and no reply <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=80363&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' /> anyone?? This is quite important.....

admin 9/23/2016

You need to contact support directly with questions like this.