I'm looking for the possibility to set the focus to the Inventory ID field when the add new record button is clicked using javascript.
I've already managed to set the focus to the Inventory ID field but this only happens when the form is initialized, I've done that by using the following javascript code snippet
<script type="text/javascript">
function FormView_Load() {
px_callback.addHandler(setFocusOnCustRef);
return;
}
var setFocus = true;
function setFocusOnCustRef(context, error) {
if (setFocus === true) {
setFocus = false;
var InventoryID = px_alls["edInventoryCD"];
InventoryID.focus();
}
return;
}
</script>
The result I'm expecting is to set the focus when the page starts (Working so far) and when the Add New button is clicked on the page as well (this behavior doesn't Initialize the form again so it won't set the focus to the field).