4 Replies Latest reply on Sep 28, 2006 6:37 AM by mkt

    Returning Value from Popup

      I know very little about Java Script (except how to spell it) so please be kind.

      I know that JS will do what I am trying to do but I have no clue how to do it. I have a form called acty_add_one.cfm that is a data entry form. The user is allowed to select a contact to associate to an activity on this form. I want to be able to click on an icon at the contact field and have a popup window appear which will display a list of contacts based on my query results. This actually works BUT I do not know how to allow the user to be able to click on the cont_row_id field and return that value back to the acty_add_one.cfm and display the actual cont row id that is returned.

      The acty_add_one.cfm calls contact_lookup.cfm and I have posted them as attachments. I hope this makes sense.
      any help you can give will be greatly appreciated.
        • 1. Re: Returning Value from Popup
          Scott Stroz Level 1
          You can reference the window that opened a window by using 'window.opener'.

          So, for example, if the name of your contact form field is contact, and you have only 1 form on the main page, you would use the following JavaScript to populate that field.

          window.opener.document.forms[0].contact.value = 'some value'

          Keep in mind though, that you probably want to use an ID field in this case, which is also easy to handle, just create a hidden form field named contactID and also populate it using the same technique.

          What I typically do when the need arises to pass info back a forth is to call a function in the opening page, and pass in any necessary info like:

          window.opener.addContactInfo(arguments here)

          Hope this helps.
          • 2. Re: Returning Value from Popup
            mkt Level 1
            OK, I am getting there but not just yet. Two thing:
            1. I want the cont_row_id value to appear as a button, which work, but each record is a different size. I would like for them to all be the same size.

            2. When I try to click on the cont_row_id button nothing happens - I just get an '! error on page" at the bottom - no explanation.

            Here is my code:

            • 3. Re: Returning Value from Popup
              Scott Stroz Level 1
              window.opener.formPicker.forms[0].acty_cont_row_id='cont_row_id' might need to be

              • 4. Re: Returning Value from Popup
                mkt Level 1
                That does not appear to work either. Any other suggestions? By the way, I really appreciate the help - thanks.