Checkbox validation issues

sofia 18 Mar, 2008
Hello Bob,

I need some help.

At http://cp03.buyhttp.com/~insidepd/index.php?option=com_content&task=view&id=466&Itemid=106 i'm building a form so my site users can upload photos and videos, that will be published in the site.

I want then to have to check the 2 checkboxes at the end of the form, because, this way, they confirm they are the owners of th content and grant me the right to use it on the site.

I have inserted the field names (autorizacao, propriedade) in the validation tab, without spaces, this time😛

But it's not working. The form code is:

<?php
global $my,$mosConfig_live_site;
// verifica se o utilizador fez login
// o nome e email são preenchidos automáticamente e definidos como read only
//$readonl="";
if ($my->id) {
//$readonl=" readonly='readonly'";
} 
?>


<table width="500" cellspacing="5">
<tr><td valign="middle"><label for="user">Nome</label></td>
    <td valign="middle"><input name="user" type="text" id="user" value="<?php echo $my->name?>"<?php echo $readonl?> /></td></tr>
    
<tr><td valign="middle"><label for="email">Email</label></td>
    <td valign="middle"><input name="email" type="text" id="email" value="<?php echo $my->email?>"<?php echo $readonl?> /></td></tr>
    
<tr><td valign="middle"><label for="telefone">Telefone</label></td>
	<td valign="middle"><input name="telefone" type="text" id="telefone" /></td></tr>
<tr>
  <td valign="middle"> </td>
  <td valign="middle"> </td>
</tr>
<tr>
  <td colspan="2" valign="middle"><h2>Conteúdos</h2></td>
  </tr>
<tr>
  <td valign="middle">Ficheiro</td>
  <td valign="middle"><input type="file" name="anexo1" id="anexo1" /></td>
</tr>
<tr>
  <td valign="top">Descrição</td>
  <td valign="middle"><textarea name="descricao1" cols="38" rows="5" id="descricao1"></textarea></td>
</tr>
<tr>
  <td valign="middle">Ficheiro</td>
  <td valign="middle"><input type="file" name="anexo2" id="anexo2" /></td>
</tr>
<tr>
  <td valign="top">Descrição</td>
  <td valign="middle"><textarea name="descricao2" cols="38" rows="5" id="descricao2"></textarea></td>
</tr>
<tr>
  <td valign="middle">Ficheiro</td>
  <td valign="middle"><input type="file" name="anexo3" id="anexo3" /></td>
</tr>
<tr>
  <td valign="top">Descrição</td>
  <td valign="middle"><textarea name="descricao3" cols="38" rows="5" id="descricao3"></textarea></td>
</tr>
<tr>
  <td valign="middle">Ficheiro</td>
  <td valign="middle"><input type="file" name="anexo4" id="anexo4" /></td>
</tr>
<tr>
  <td valign="top">Descrição</td>
  <td valign="middle"><textarea name="descricao4" cols="38" rows="5" id="descricao4"></textarea></td>
</tr>
<tr>
  <td valign="middle">Ficheiro</td>
  <td valign="middle"><input type="file" name="anexo5" id="anexo5"/></td>
</tr>
<tr>
  <td valign="top">Descrição</td>
  <td valign="middle"><textarea name="descricao5" cols="38" rows="5" id="descricao5"></textarea></td>
</tr>
<tr>
  <td valign="middle"> </td>
  <td valign="middle"> </td>
</tr>
<tr>
  <td colspan="2" valign="middle"><h2>Direitos de Autor</h2></td>
  </tr>	
  
<tr>
  <td colspan="2" valign="middle"><table width="100%">
    <tr>
      <td><input name="propriedade" type="checkbox" id="propriedade" value="sim" />
        <label for="propriedade">Declaro que os conteúdos enviados são minha propriedade e/ou autoria</label></td></tr>
    <tr>
      <td>
        <input name="autorizacao" type="checkbox" id="autorizacao" value="sim" />
        <label for="autorizacao">Autorizo o portal pegadas.iol.pt, a utilizar estes conteúdos, sem restrições.</label></td></tr>
  </table>  </td>
  </tr>
<tr>
  <td valign="middle"> </td>
  <td valign="middle"> </td></tr>
<tr><td valign="middle"> </td>
    <td valign="middle"><input type="reset" value="Limpar" class="button" /> <input type="submit" value="Enviar" class="button"></td></tr>			
</table>


I have looked in the forum for a solution, but haven't found anything that fits my case.

Thanks,

Sofia
Max_admin 18 Mar, 2008
Hi Sofia,

I'm sorry to tell this but the current validation doesn't support checkboxes validation so you will need to add a small JS to check for this, something like :

if(document.getElementById('checkbox1').checked == false)
alert('check me');


Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.