Forums

Check Box information not saving

graphmaster 26 Mar, 2010
I have a survey at http://www.roswelljackfm.com/index.php?option=com_chronocontact&chronoformname=topten where I need people to check ONLY ten of the bands. That is it's own nightmare, but the biggest problem I have right now is regardless of how many bands they select, nothing shows up in the database but the CF member number and IP address, etc.

Not one selection on a check box appears. How can I have the band name show up when something is selected? How can I limit it to 10 selections as well?

I need this up asap. PLEASE HELP!
graphmaster 26 Mar, 2010
O.K. I went ahead and created the form in Dreamweaver. I then put in the custom code (including the Javascript). The form emails to me, but it emails it to me without any of the selections chosen. Basically I just get an email of my form.

Again, the database is also only updated with the default IP, etc. - no check boxes. The Javascript won't even work. I enabled the Captcha, but it will not appear on the page and when I submit the form, it tells me I have an incorrect verfication code.

This just isn't working for me. Is it me?
graphmaster 26 Mar, 2010
The link to the custom form is http://www.roswelljackfm.com/index.php?option=com_chronocontact&chronoformname=toptentest I realize the formatting is not right, but that is the least of my worries right now.

Just to be clear how I set it up for the custom form. This is put in the Form HTML under Form Code:
<table border="0" width="250" cellspacing="0" cellpadding="0" align=center>



<tr bgcolor="#ffffcc"><td > </td><td ><b>Choice</b></td></tr>
<tr bgcolor="#f1f1f1" ><td ><input type=checkbox name=ckb value=PHP onclick="chkcontrol(0)";></td><td >PHP</td></tr>
<tr bgcolor="#ffffff" ><td ><input type=checkbox name=ckb value=PERL onclick="chkcontrol(1)";></td><td >Perl</td></tr>
<tr bgcolor="#f1f1f1" ><td ><input type=checkbox name=ckb value=MySQL onclick="chkcontrol(2)";></td><td >MySQL</td></tr>
<tr bgcolor="#ffffff" ><td ><input type=checkbox name=ckb value=4 onclick="chkcontrol(3)";></td><td >ASP</td></tr>
<tr bgcolor="#f1f1f1" ><td ><input type=checkbox name=ckb value=5 onclick="chkcontrol(4)";></td><td >JavaScript</td></tr>
<tr bgcolor="#ffffff" ><td ><input type=checkbox name=ckb value=6 onclick="chkcontrol(5)";></td><td >CSS</td></tr>
<tr bgcolor="#f1f1f1" ><td ><input type=checkbox name=ckb value=7 onclick="chkcontrol(6)";></td><td >HTML</td></tr>
<tr bgcolor="#ffffff" ><td ><input type=checkbox name=ckb value=8 onclick="chkcontrol(7)";></td><td >Photo Shop</td></tr>
</table>
<p>
  <label>Send my choices!
  <input type="submit" name="Submit" id="Submit" value="Submit">
  </label>
</p>


And this is what I put in the Form Javascript
<script type="text/javascript">
function chkcontrol(j) {
var total=0;
for(var i=0; i < document.form1.ckb.length; i++){
if(document.form1.ckb[i].checked){
total =total +1;}
if(total > 3){
alert("Please Select only three") 
document.form1.ckb[j].checked = false ;
return false;
}
}
} </script>


The Anti-spam is on with image verification, but does not show up on the form. The email works when I turn off the anti-spam, but I just get a copy of my form with no selections. The Javascript does not check if less than 3 items are selected.
GreyHead 26 Mar, 2010
Hi graphmaster,

a) Your checkbox array needs to use an array name to gt all the values returned, at present you will only get the last one.

b) You probably don't have a ckb column in your database table.

c) You have script tags that you don't need in the JavaScript Box.

d) You don't have {imageverification} in the Form HTML to display the captcha image & input.

Bob
graphmaster 26 Mar, 2010
Bob,
Thanks so much! I was able to get the image verification to work, all is working now except the Javascript verification.


c) You have script tags that you don't need in the JavaScript Box.

What is there that doesn't need to be? The JavaScript is still not working (probably because of this)

Thanks so much!
graphmaster 26 Mar, 2010
I created a form with the Form Wizard and then went in and edited the code to add the Javascript verification. Each checkbox also has an array and the table has a check0 table. (I completely created a new table through the Create Table using the info from the previous post).

<input onclick="chkcontrol(0)" value="Led Zeppelin" title="" class="radio validate-one-required" id="check00" name="check0[]" type="checkbox" />
      <label for="check00" class="check_label">Led Zeppelin</label>


I have it emailing the results and saving them to the database. I did have to go into Create Table more than once and save it for the information to save to the database though.

Anyway, it all is working but the Javascript that limits it to ten choices.

The form is herehttp://www.roswelljackfm.com/index.php?option=com_chronocontact&chronoformname=topten

This is what I put in the JavaScript box under the Form Code
<!--
function chkcontrol(j) {
var total=0;
for(var i=0; i < document.form1.check0.length; i++){
if(document.form1.check0[i].checked){
total =total +1;}
if(total > 10){
alert("Please Select only ten") 
document.form1.check0[j].checked = false;
return false;
}
}
}
// -->


I even tried to take off the <!-- // --> elements as well, but the code still does not work.

What am I doing wrong?
graphmaster 26 Mar, 2010
Sorry for all the bother I loaded a new Javascript and all seems to be working now. I still haven't figured out the table problem (why I had to go into create table more than once to have it work), but it is all working fine now.

Thanks so much! This is great software!
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger