How To Set Focus To The First Field In An InfoPath Form Web Part
InfoPath Form Web Parts seems to be slightly different. If you have a form in a web part, the focus upon page load is not anywhere in the form even if you have the tab index set in InfoPath Designer. The first logical answer may be to use JQuery for this simple housekeeping task. After all, you make the end users life a little easier. Unfortunately, JQuery (element.focus()) won’t work, not even for any other control on a page that has the InfoPath web part (JQuery does work in other scenarios and other web parts and forms). InfoPath forms have additional script handlers and that could be the issue.
As I faced this scenario recently, I decided to check the good old JavaScript with a timer, so setTimeout way the way out. Add a content editor web part to the page, edit its source and type the following:
Of course, you need to substitute your own ID for the text box you want to give the focus (view source or use Dev tools to get that). When done, click OK and in the CEWP settings, set Hidden to true (check the box) in Layout.
Your page with the web part form should now load with your favorite element having the focus and the cursor is ready there (this may take a little while, try a value less than 1000 but small values may not work).