Copy form data to another window

Discussion in 'JavaScript' started by tbarr60, Oct 29, 2008.

  1. #1
    We have a process where we copy data from one form in one window into the same form in another window. I can't change the form or any other aspects of the pages as it is a hosted application.

    I'd like to create a Javascript function that copies all form fields in one window and pastes into the same form fields in the second window. I am messing around with iFrames as a nice way to lay it out but I am having trouble referencing the fields in the iFrames.

    What would be a way to code a copy and paste function that determines the form fields available and copies fields over?
     
    tbarr60, Oct 29, 2008 IP
  2. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #2
    If the fields you are copying/pasting are on different domains, then javascript doesn't allow this. Called cross-site scripting. However with Greasemonkey you could probably do this. Let me know if you want me to program a greasemonkey script. Give me an offer. And the greasemonkey thing would only work on your computer, it wouldn't work as a thing hosted online because of the cross-site scripting security issue.
     
    profs77, Oct 30, 2008 IP
  3. tbarr60

    tbarr60 Notable Member

    Messages:
    3,455
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    210
    #3
    I am familiar with cross site scripting. In this case, it works somewhat like a Google Tool Bar's Autofill. In this case it would be auto-filling with information it auto-copied from another window.

    I still want to work out a Javascript solution but may come back to using Creasemonkey.
     
    tbarr60, Oct 31, 2008 IP