Has anyone successfully set the cursor on a pagelo...
# suitescript
d
Has anyone successfully set the cursor on a pageload to a random field? It appears NetSuite overrides any attempt to do this and always sets focus on the line item? So annoying... I tried client script pageInit as well as DOM injection on beforeLoad userevent. Any other ideas? var fieldFocus = document.getElementById("duedate"); fieldFocus.focus();
e
I've done this on saveRecord;
Copy code
setTimeout(function(){
	document.getElementById("duedate").focus({ focusVisible: true });
}, 250);
not sure about pageInit though
d
Hmm, thanks. I don't want to set a timeout on page load since it's painfully slow already.. I can actually see the focus going to the due date field and then jump to the line item. Very frustrating, but thanks for the input.
👍 1
c
@Dan P spitballing here: attach a listener / observer that detects both the focus on the line item field and considers a boolean variable you create - if the flag is false, focus on the due date and set the flag to true?
c
Either way you gotta use jquery dark arts. There's pros and cons here in that you can do what you're wanting here but netsuite can also pull the rug at anytime without any notification on field IDs and whatnot so while not highly likely, its possible the solution just stops working one day.
its a pretty common request though would be nice for a native API function to do this and be safe about it
💯 1