New Parent document not updating with child values on web

I create a new document on the web. On that document I have a button which is used to update multi-value fields in a table.

The button opens a new window where the user updates the values that are sent/populated down to the new parent document/window.

This works fine for existing (already saved) documents. But for a new document, it does not work on the first try. On the second try it works.

Here is what happens:

  1. Click the button – the Add button – to add new values to the multi-value fields

  2. New window opens, user adds values to the fields

  3. In the new window, user clicks a button “Update” which updates the fields on the parent document through submitting (window.opener.document.forms[0].submit():wink: the parent document

  4. Parent document opens back up to itself based on the $$Return field in Read Mode

  5. Fields are not updated

  6. User clicks “Edit Document” to open in Edit mode

  7. User clicks the “Add” button again

  8. User updates the values in the new window that appears

  9. User clicks “Update” which updates the fields on the parent document through submitting the parent document

  10. Parent document is opened in Read Mode through the $$Return field

  11. Fields are now updated

The javascript in the “Update” button is working, the $$Return field is working, it just takes 2 rounds of this to get the fields on the parent document to updated.

I have tried saving the document (so I can get the correct document UNID) before the “Add” button is presented to the user, but that does not work. It still takes 2 rounds.

Do the multi-values fields on the parent document have to have some value in them before the user clicks the “Add” button? It seems that maybe the fields are not yet “noticed” by the JavaScript in the child window…

I know there is a better way, however, I am in a time crunch on this project… The databases are old and I am trying to convert existing functions to the web without a major re-write…

Any help would be great!

Thanks!

Dan