SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2005
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    child > parent appending data

    I have a email form that has a link to a popup listing contacts in a form with checkboxes for to, cc, bcc.

    Now the problem i'm having is how do i take all three arrays (to, cc, bcc) and append them to the possible values that are already in the parent form?

    here is some of the code that i've tried, but it don't seem to work. Keep in mind that i'm not the best person with javascript code so hold on tight :P

    Code:
    <script type="text/javascript">
    
    function whenSubmit(f) {
    	var i = 0;
    	var textBuild = 'here ';
    	
    	while(f['to['+i+']']){
    		
    		if(f['to[' + i + ']'].checked) {
    			textBuild + ';' + f['to[' + i + ']'];
    		}
    		i++;
    	} 
    	
    	window.opener.document.getElementById('composeTo').value=textBuild;
    	//window.close();
    }
    
    </script>
    any ideas how i can get this working?

  2. #2
    SitePoint Addict dek's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I can tell, what your code is doing, is checking through the form, looking for elements named to[0], to[1] (I'm guessing serverside would be PHP) ... then for each one that's checked, you're trying to add the checkbox object to your text string.... which isn't going to look pretty.

    Code:
    textBuild + ';' + f['to[' + i + ']'].value;
    might work better, but it depends on how you set the form up...
    Only dead fish go with the flow

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2005
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply. I'm totaly open for suggestion on how to get htis done. If youknow a better way of doing it then please let me know as i'm not the best person at javascript.

    But basically all i'm trying to do is generate a string containing email address's in a child window and populate a form field in a parent window with the selected email address's.

    I tried added the .value as you mentioned but i get an error stating "window.parent.document.getElementById[...] is null or not an object" any ideas on how i tackle this would be awesome.

    Thanks!


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
  •