JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 4th, 2002, 12:17 PM
scrtagt69 scrtagt69 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 53 scrtagt69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 46 sec
Reputation Power: 12
checkboxes and javascript

Im creating an admin page in php that allows users to mail individual people from a database. the mail form is named frmCompose with a to field which when clicked is a popup with everyones name in the database by rows of 20, and there are currently bout 250 users. What im trying to do is check boxes on certain individuals, then when im all done selecting the individuals, click on a compose mail button, and it transfers the names i selected to the TO field of the email form. The mail form is complete as well as the popup...the problem is the javascript. heres the javascript i have in the popupwindow.

<script language="Javascript">
<!--
this.window.focus()

function SetChecked() {
Ffrm=document.composeForm
Sfrm=document.addressForm
Ffrm.to.value=''
var i=0
len=Sfrm.elements.length
for( i=0 ; i<len ; i++) {
if (Sfrm.elements[i].name=='to[]' && Sfrm.elements[i].checked) {
Ffrm.to.value+=','+Sfrm.elements[i].value
}
}}

function Compose() {
Ffrm=document.composeForm

SetChecked()
var to=Ffrm.to.value
Vfrm=this.opener.document.frmCompose
if (Vfrm != null) {
if (Vfrm.to.value == '') {
to = to.substring(1, to.length)
}
Vfrm.to.value += to
window.close()
return
}
Ffrm.to.value = to.substring(1, to.length)
Ffrm.submit()
Sfrm.reset()
}
//-->
</script>


im also using these forms

echo "<FORM NAME=\"composeForm\">"; echo "<INPUT TYPE='hidden' NAME='to' VALUE=''>";
echo "</FORM>";
echo "<FORM NAME=\"addressForm\" method=\"post\">";


The first form stores the values, and the second form actually is the form with the list of people.

the checkbox code im using is this

echo "<input type=checkbox name=to[] value=\"$row->current_email\">\r\n";

Ok this code works without the [] and static checkboxes, but with the brackets in when i hit compose mail, i just got commas, in the To field of the email form depending on how
many people I check. I have read through the forums and found some problems with these brackets, I just can figure it out with my code here. Can someone please tell me whats wrong. Thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > checkboxes and javascript

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap