From parent to iframe form input

Javascript coding ..

Moderators: macek, egami, gesf

AceEmbler
New php-forum User
New php-forum User
Posts: 21
Joined: Thu Jul 01, 2004 6:52 am

From parent to iframe form input

Postby AceEmbler » Mon Jul 12, 2004 5:38 am

I need to send data from input in parent window to input inside iframe. How can i do this ?? :help:

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Mon Jul 12, 2004 9:39 am

Your form target will be the name of your iframe!

Code: Select all

<form name="whatever" target="iframe_name" action="whatever">
...
</form>

AceEmbler
New php-forum User
New php-forum User
Posts: 21
Joined: Thu Jul 01, 2004 6:52 am

Postby AceEmbler » Mon Jul 12, 2004 1:34 pm

i dont think you know what i want to do.


SIMPLY:

I have got Page this page have got 3x <input type="text" and one Iframe. Iframe contains 3x <input type="text" i want send text from my parent inputs to my iframe inputs but on client mashine. With youre example how am i suposed to fill my <inputs ??

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Mon Jul 12, 2004 5:17 pm

Oh i see!
It would be something like:

Code: Select all

iframe_name.form_name.field_name.value = whatever

Try this out (give forms to those fields):

Code: Select all

// In the sender form submition call this function
// Replace what you need to

<script language="JavaScript">
  function PassIt(){
    var form1 = window.document.form1_name_here;
    var form2 = iframe_name_here.document.form2_name_here;

    for (var i = 0; i < form1.elements.length; i++){   
     eval("form2.elements[" + i + "].value = form1.elements[" + i + "].value"); 
   }
}
</script>


Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 1 guest