SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Italy
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Htmlrarea] Parent/child windows communication trouble

    Hi all i have a form (myform) with a standard textarea (mytextarea)
    and a link beside the form to open htmlarea3 in a popup and edit
    the content of the textarea.

    In the popup i have this code to load the content from "mytextarea" (parent window)
    into htmlArea (child window):

    <script type="text/javascript">
    document.forms.form_name.textarea_name.value = window.opener.document.forms.myform.mytextarea.value
    </script>

    and the code above works so the content is correctly transfered into htmlarea

    I have another function to send the content of the textarea back to "mytextrarea":

    <script type="text/javascript">
    function updateTextarea()
    {
    window.opener.document.forms.myform.mytextarea.value = document.forms.form_name.textarea_name.value;
    window.close()
    }
    </script>

    The form on the child window (where htmalrea is built) is:

    <form action=..... method=post name="form_name">
    <div><textarea id="editor" class="textarea" name="textarea_name" rows="30" cols="60"></textarea></div>
    <input class="button" type="button" value="Ok" onClick="updateTextarea()">
    <input onclick="window.close()" type=button value="Cancel">
    </form>

    For some strange reason when i click the OK button,the popup close
    but the content in the original textarea (mytextarea) is not updated.
    I guess i have to fix something.
    Can you give me a helping hand?
    Thanks in advance,ronnie.

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try changing this line:
    window.opener.document.forms.myform.mytextarea.value = document.forms.form_name.textarea_name.value;

    To this:
    window.opener.document.myform.mytextarea.value = document.form_name.textarea_name.value;

    Because you are giving the form name you should not have to use "forms".

  3. #3
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Italy
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by requestcode
    Try changing this line:
    window.opener.document.forms.myform.mytextarea.value = document.forms.form_name.textarea_name.value;

    To this:
    window.opener.document.myform.mytextarea.value = document.form_name.textarea_name.value;

    Because you are giving the form name you should not have to use "forms".
    Thank you requestcode,
    i've tried your suggestion but it still doesn't work.
    I think it's htmlarea that doesn't send the value back to the opener.
    In fact i've tried to use typetool instead of htmlarea and the communication is perfect.
    Any other idea?

  4. #4
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you getting any type of JavaScript error?

  5. #5
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Italy
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No,my firefox's javascript console is clean.
    I can't understand what to fix.
    The key is the way the htmlrarea on the popup(child) window relates with the original standard textarea on the parent window.
    Are you experienced with htmlarea 3.0?
    What else can i try?

  6. #6
    SitePoint Evangelist anjanesh's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Version 3 is still in beta. RC1 is out. Check the forums.
    http://www.interactivetools.com/ifor...a_Release_F14/
    Anjanesh

  7. #7
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Italy
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you all,
    i finally solved by replacing the line above:
    >>>>>>>>>>>>>>>>>>>

    window.opener.document.forms.myform.mytextarea.value = document.forms.form_name.textarea_name.value;

    >>>>>>>>>>>>>>>>>>>

    with:

    >>>>>>>>>>>>>>>>>>>

    window.opener.document.forms.myform.mytextarea.value = editor.getHTML();

    >>>>>>>>>>>>>>>>>>>

    Thanks again,ronnie.


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
  •