Applescript - Safari - Submitting A Form With No Button

Hi there,

I’m currently using the following code to input text into a search box on a website:

inputByID("TextField", "Some Text")


to inputByID(theId, theValue) 
	tell application "Safari" 
		do JavaScript "  document.getElementById('" & theId & "').value ='" & theValue & "';" in document 1 
	end tell
end inputByID

The problem is, the text box has no submit button. You are supposed to hit the return key to submit the search string.
Is it possible to do this without having to simulate a Return key press through system events?

Thanks!
Adam

I have limited experience with this type of thing, but I suspect it’s possible. But I don’t think we’ll be able to create a functional example without being able to look at the website in question.

But I think it would look something like this:

tell application "Safari" to  do JavaScript " document.getElementById('theForm').submit();'"

With “theForm” modified to something applicable to the webpage in question.