SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    changing value of form field from popup window?

    Hello,

    I'm in need of help again I need to change the value of a text box from a popup window. Cna this be done? I know that

    document.forms['formname'].elements['textareaname'].value = 'whatever i really want to be honest';

    Will change the value of a field on the same page, but what about the parent window (or whatever its called with popups )?

    Thanks

    [Edit: Can I do this as well with hidden fields?]
    Mike
    It's not who I am underneath, but what I do that defines me.

  2. #2
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would it simply be:

    parent.document.forms['formname'].elements['textareaname'].value = 'whatever i really want to be honest';

    ?
    Mike
    It's not who I am underneath, but what I do that defines me.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2002
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe you can change global variables in the opener page from the pop up page like this:
    opener.variablename = blabla;
    Don't know if this is any help though.

  4. #4
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ~
    Last edited by naramation; Sep 17, 2002 at 17:55.
    Mike
    It's not who I am underneath, but what I do that defines me.

  5. #5
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    something like this?

    PHP Code:

         
    <script type="text/javascript">
         <!--

           function 
    popup(urlnameparam)
           {
             
    win window.open(urlnameparam);
             return 
    win;
           }
           
    popup('''''');
           
    x.window.document.write('<form action="" method="get">');
           
    x.window.document.write('<input type="text"   name="fname" value="" /><br />');
           
    x.window.document.write('<input type="text"   name="lname" value="" />');
           
    x.window.document.write('<input type="submit" name="send"  value="send" />');
           
    x.window.document.write('</form>');

           
    x.document.all['fname'].value 'new value';
         
    // -->
         
    </script> 

  6. #6
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kind of, but I have a page where it says "Please enter the URL of the image or browse our Gallery". So the user clicks Gallery and a window pops up with all my pics in it (It'll be a php page). And when the user clicks the desired image, its URL is inserted into a text box back on the main page where it said "Please enter the url..."
    Mike
    It's not who I am underneath, but what I do that defines me.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •