Hi to all,
i´m new to the forum and also to javascript
i´m having a problem that seems very simple, yet i can´t get it to work
the thing is i wan´t to put in my website a Mailchimp form so users can subscribe to my email list
i´ve used the form they provide, but in the form there is several checkboxes were the subscriber can select wich subjects he is interest to receive email from us
and the the bottom of this checkboxes there is an option “all of them”
so what i want is when the person clicks on the “all of them” option all others gets unchecked and disabled ( that´s because i want him to subscribe to the list “all” and not to all lists)
i have this code that is working fine
[CODE]
<div id=”mc_embed_signup”>
<form action=”http://bfkfskfgkf.us2.list-manage1.com/” method=”post” id=”mc-embedded-subscribe-form” name=”mc-embedded-subscribe-form” class=”validate” target=”_blank”>
<fieldset>
<br/>
<div class=”mc-field-group”>
<label class=”input-group-label”>interesse </label>
<div class=”input-group” >
<table id=”intere” width=”590″ cellspacing=”1″ >
<tr >
<td width=”176″><label>
<input type=”checkbox” value=”1″ name=”group[1][1]” id=”option0″>
<label for=”mce-group[1]-1-0″>Area 1</label></td>
<td width=”105″><input type=”checkbox” value=”2″ name=”group[1][2]” id=”option1″><label for=”mce-group[1]-1-1″>Area 2</label></td>
<td width=”141″><input type=”checkbox” value=”4″ name=”group[1][4]” id=”option2″><label for=”mce-group[1]-1-2″>Area 3</label></td>
<td width=”153″><input type=”checkbox” value=”8″ name=”group[1][8]” id=”option3″><label for=”mce-group[1]-1-3″>Area 4</label></td>
</tr>
<tr>
<td><input type=”checkbox” value=”65536″ name=”group[1][65536]” id=”option4″><label for=”mce-group[1]-1-4″>Area 5</label></td>
<td><input type=”checkbox” value=”16″ name=”group[1][16]” id=”option5″><label for=”mce-group[1]-1-5″>Area 6</label></td>
<td><input type=”checkbox” value=”32″ name=”group[1][32]” id=”option6″><label for=”mce-group[1]-1-6″>Area 7</label></td>
<td><input type=”checkbox” value=”64″ name=”group[1][64]” id=”option7″><label for=”mce-group[1]-1-7″>Area 8</label></td>
</tr>
</table>
<input type=”checkbox” value=”32768″ name=”group[1][32768]” id=”opcao8″ onclick=”jqCheck(this.id, ‘intere’);”><label for=”mce-group[1]-1-16″>Todas</label>
</div>
</div>
<br/>
<div id=”mce-responses”>
<div class=”response” id=”mce-error-response” style=”display:none”></div>
<div class=”response” id=”mce-success-response” style=”display:none”></div>
</div>
<div><input type=”submit” value=”Enviar” name=”subscribe” id=”mc-embedded-subscribe” class=”btn”></div>
</fieldset>
<a href=”#” id=”mc_embed_close” class=”mc_embed_close”></a>
</form>
</div>
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js”></script>
<script type=”text/javascript”>
function jqCheck( id, pID )
{
$( “#” + pID + ” :checkbox”).attr(‘disabled’, $(‘#’ + id).is(‘:checked’)).attr(‘checked’, $(‘#’ + id).is(‘:disabled’));
}
</script>
notice that all checkboxes have the id like “option1, option2, option3…”
but if i use the ids Mailchimp give to his form “mce-group[1]-1-1, mce-group[1]-1-1…” as bellow, the script no longer works properly. How can i get it to work?
[CODE]
<div id=”mc_embed_signup”>
<form action=”http://bfkfskfgkf.us2.list-manage1.com/” method=”post” id=”mc-embedded-subscribe-form” name=”mc-embedded-subscribe-form” class=”validate” target=”_blank”>
<fieldset>
<br/>
<div class=”mc-field-group”>
<label class=”input-group-label”>interesse </label>
<div class=”input-group” >
<table id=”intere” width=”590″ cellspacing=”1″ >
<tr >
<td width=”176″><label>
<input type=”checkbox” value=”1″ name=”group[1][1]” id=”mce-group[1]-1-0″>
<label for=”mce-group[1]-1-0″>Area 1</label></td>
<td width=”105″><input type=”checkbox” value=”2″ name=”group[1][2]” id=”mce-group[1]-1-1″><label for=”mce-group[1]-1-1″>Area 2</label></td>
<td width=”141″><input type=”checkbox” value=”4″ name=”group[1][4]” id=”mce-group[1]-1-2″><label for=”mce-group[1]-1-2″>Area 3</label></td>
<td width=”153″><input type=”checkbox” value=”8″ name=”group[1][8]” id=”mce-group[1]-1-3″><label for=”mce-group[1]-1-3″>Area 4</label></td>
</tr>
<tr>
<td><input type=”checkbox” value=”65536″ name=”group[1][65536]” id=”mce-group[1]-1-4″><label for=”mce-group[1]-1-4″>Area 5</label></td>
<td><input type=”checkbox” value=”16″ name=”group[1][16]” id=”mce-group[1]-1-5″><label for=”mce-group[1]-1-5″>Area 6</label></td>
<td><input type=”checkbox” value=”32″ name=”group[1][32]” id=”mce-group[1]-1-6″><label for=”mce-group[1]-1-6″>Area 7</label></td>
<td><input type=”checkbox” value=”64″ name=”group[1][64]” id=”mce-group[1]-1-7″><label for=”mce-group[1]-1-7″>Area 8</label></td>
</tr>
</table>
<input type=”checkbox” value=”32768″ name=”group[1][32768]” id=”mce-group[1]-1-8″ onclick=”jqCheck(this.id, ‘intere’);”><label for=”mce-group[1]-1-16″>Todas</label>
</div>
</div>
<br/>
<div id=”mce-responses”>
<div class=”response” id=”mce-error-response” style=”display:none”></div>
<div class=”response” id=”mce-success-response” style=”display:none”></div>
</div>
<div><input type=”submit” value=”Enviar” name=”subscribe” id=”mc-embedded-subscribe” class=”btn”></div>
</fieldset>
<a href=”#” id=”mc_embed_close” class=”mc_embed_close”></a>
</form>
</div>
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js”></script>
<script type=”text/javascript”>
function jqCheck( id, pID )
{
$( “#” + pID + ” :checkbox”).attr(‘disabled’, $(‘#’ + id).is(‘:checked’)).attr(‘checked’, $(‘#’ + id).is(‘:disabled’));
}
</script>
thnks everyone