Q:

Why doesn't my form submit automatically? 

I don't see what is wrong, does submit() not work anymore?  
<html>
<head>
    <title>This is the title</title>
    <script type = "text/javascript">

        function onLoad() {
            document.getElementById("input1").value="text1";
            document.getElementById("input2").value="text2";
            document.getElementById('form').submit();
        }

    </script>
</head>
<body onload="onLoad();">
<form method="post" name="form" id="form" action="test.txt">
    <label for="input1">Input1</label> <input id="input1" name="input1" type="text"/>
    <label for="input2">Input2</label> <input id="input2" name="input2" type="text"/>
    <input name="submit" id="submit" value="submit" type="submit"/>
</form>
</body>
</html>

A:

Your problem is that the button is named submit and hs id submit.   Change that and it works. 
You overwrote submit function with a submit button element.