I know its very late to reply this question, but adding the answer so might help any one else.

Let say we want to submit the form as soon as the page get loaded.
I have marked my changes as bold...