You want to pass a parameter value through URL to a new form and populate a field of the item (in this example a lookup field).
- Using SPD, create a New Form aspx page (you can also work directly on the NewForm.aspx page).
- Using the browser, connect to the aspx page and click Edit.
- Insert the Script Editor web part and add the relevant code (see below)
- Stop Editing the page (it will be automatically saved), and Cancel the form.
Now, you will be able to call the web page using URL parameter YourField:
newform.aspx?YourField=22
and open the form with the related lookup field populated with the item with ID 22.
Line 19 - how do I find the value for the .getElementByID string?