File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Autofill HTML/JS Iframes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Autofill HTML/JS Iframes" Watch "Autofill HTML/JS Iframes" New topic
Author

Autofill HTML/JS Iframes

Josh A. Smith
Greenhorn

Joined: Feb 06, 2013
Posts: 2
Hello All,

I've seem to hit a dead end but wanted to see if someone might have an answer I cannot find (if the answer exists!) I'm trying to create a script to do a simple auto fill function across an Iframe.

Long story: I will have a home made local page on the desktop of a computer. I will eventually get it where information will be added and sorted. We use a site that requires duplicate information and while copy and paste works, there is a lot of additional fields that requires copying and pasting. This would just help my day so much more.

So with that out of the way, starting from scratch. Is it possible to somehow take one page whether the index or an iframe within a page, and carry that over to another iframe with client-side scripting? No access to the server using one textbox to another?

What I do have available to use if it helps is an example here:

<input type="text" name="_name" id="_name" value="" Maxlength="1" size="1">

Short story: I need to find a way to copy contents from one text box in one iframe to another textbox in another iframe if it is possible.

Since the information does change on what needs to be entered, 3rd party software wouldn't help in this case.

I appreciate any help and will be mindful of any advice!
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 295
    
    5

It's not completely clear to me what you're trying to do here, but by default it is impossible for JavaScript loaded along with a page from one domain to access pages from other domains. Is this what you're trying to do? You can do Cross-document Messaging but that will require the co-operation of the target website. Your best option would probably be to bypass all the client scripting restrictions by writing a small browser extension.


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
Josh A. Smith
Greenhorn

Joined: Feb 06, 2013
Posts: 2
Say for example if someone had a basic page for ordering widgets. Even though there are numerous 3rd party softwares out there for this situation, just stay with me here. Instead of typing in the address each time, you would want to create one Iframe window with the Widget company and another iframe window with a htm file from the desktop of your computer.

When you paste information into the textbox on your home brewed htm file, it fills the correct field on the Widget site thus preventing me from typing it in. If I had multiple addresses, I could paste into this field and later use javascript further to format the text correctly.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If the iframe and the parent page are in the same domain, it is easy as



If they are not in the same domain, than Same Origin Policy gets in the way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Autofill HTML/JS Iframes
 
Similar Threads
Jrun, jsp:setProperty, null string array elements
escaping an iframe
Applet and Jsp , calling each other
escaping an iframe
Challenging real time question..