store index number instead of reference to form element

* be safe, and no clean-up is required
set a context parameter to query for the content document

* it is an optional parameter for the content document, but explicitly show it
  for readability