Hi all,
I'm trying to run an ajax request on an existing pulldown lookup field (called 'child'). The Ajax request needs to run when the user changes the value of the pulldown so it can populate another field in the table with custom data. I already have this working perfectly on another field which isn't a lookup field. The problem I am facing is that when I try to use addEventListener on the 'child' pulldown lookup field, it is being totally ignored. I assume that this is because it is a lookup field which is already using the addEventListener via the built-in ajax_combo.php file in order to perform the lookup itself.
I have created the file hooks/attendance-dv.js file which is where the code resides. It needs to run when users go to the 'Attendance' table. Here's the bit of code that's not working...
document.getElementById('child').addEventListener('change', function (e) {
alert('Test');
//RunAjax();
})
This should simply show an alert box saying 'Test'. I've commented out the Ajax calling function for now and I'll re-enable it once I get the addEventListener working.
I'm not that great at JS coding and am really trying my best to get this going.
Thanks in advance for any help that you may be able to offer.
Run Ajax on existing Lookup field
-
- Veteran Member
- Posts: 47
- Joined: 2016-08-28 10:37
Re: Run Ajax on existing Lookup field
$j('#child-container').on("change", function(){
alert('Test');
})
alert('Test');
})
/Giuseppe
Professional Outsourcing Services
Professional Outsourcing Services
-
- Veteran Member
- Posts: 47
- Joined: 2016-08-28 10:37
Re: Run Ajax on existing Lookup field
Perfect!!!!!!!!
Thank you so much!!!!!
Thank you so much!!!!!
