Joomla.it Forum
Joomla! 2.5 (versione con supporto terminato) => Joomla! 1.6/1.7/2.5 => : guardiano 23 May 2013, 12:46:50
-
salve, ho inserito una checkbox con relativo javascript per renderla obbligatoria.
Funziona, ma funziona troppo, più de necessario :-)
Cioè quando la checkbox non è fleggata manda il messaggio di errore.
Quando è fleggata non manda nessun messaggio di errore.
Fin qui è tutto esatto.
Il problema è che dopo non mi esegue la registrazione ma rimane fermo a non far niente.
Di seguito il contenuto del file:
<?php
/**
* @version $Id: register.php 1206 2011-10-17 21:09:08Z joomlaworks $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.gr
* @copyright Copyright (c) 2006 - 2011 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
?>
<!-- K2 user register form -->
<?php if(isset($this->message)) $this->display('message'); ?>
<div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" style="text-align:center;">
Modulo di Registrazione
</div>
<form action="<?php echo JRoute::_('index.php'); ?> " enctype="multipart/form-data" method="post" id="josForm" name="josForm" class="form-validate" >
<?php if($this->params->def('show_page_title',1)): ?>
<div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<div id="k2Container" class="k2AccountPage">
<table class="admintable" cellpadding="0" cellspacing="0">
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_('K2_ACCOUNT_DETAILS'); ?>
</th>
</tr>
<tr>
<td class="key">
<label id="namemsg" for="name">Cognome e <?php echo JText::_('K2_NAME'); ?></label>
</td>
<td>
<input type="text" name="<?php echo (K2_JVERSION=='16')?'jform[name]':'name'?>" id="name" size="40" value="<?php echo $this->escape($this->user->get( 'name' )); ?>" class="inputbox required" maxlength="50" />
*
</td>
</tr>
<tr>
<td class="key">
<label id="usernamemsg" for="username"><?php echo JText::_('K2_USER_NAME'); ?></label>
</td>
<td>
<input type="text" id="username" name="<?php echo (K2_JVERSION=='16')?'jform[username]':'username'?>" size="40" value="<?php echo $this->escape($this->user->get( 'username' )); ?>" class="inputbox required validate-username" maxlength="25" />
*
</td>
</tr>
<tr>
<td class="key">
<label id="emailmsg" for="email"><?php echo JText::_('K2_EMAIL'); ?></label>
</td>
<td>
<input type="text" id="email" name="<?php echo (K2_JVERSION=='16')?'jform[email1]':'email'?>" size="40" value="<?php echo $this->escape($this->user->get( 'email' )); ?>" class="inputbox required validate-email" maxlength="100" />
*
</td>
</tr>
<?php if(K2_JVERSION == '16'): ?>
<tr>
<td class="key">
<label id="email2msg" for="email2"><?php echo JText::_('K2_CONFIRM_EMAIL'); ?></label>
</td>
<td>
<input type="text" id="email2" name="jform[email2]" size="40" value="" class="inputbox required validate-email" maxlength="100" />
*
</td>
</tr>
<?php endif; ?>
<tr>
<td class="key">
<label id="pwmsg" for="password"><?php echo JText::_('K2_PASSWORD'); ?></label>
</td>
<td>
<input class="inputbox required validate-password" type="password" id="password" name="<?php echo (K2_JVERSION=='16')?'jform[password1]':'password'?>" size="40" value="" />
*
</td>
</tr>
<tr>
<td class="key">
<label id="pw2msg" for="password2"><?php echo JText::_('K2_VERIFY_PASSWORD'); ?></label>
</td>
<td>
<input class="inputbox required validate-passverify" type="password" id="password2" name="<?php echo (K2_JVERSION=='16')?'jform[password2]':'password2'?>" size="40" value="" />
*
</td>
</tr>
<tr>
<td class="key" style="vertical-align:top;">
<label>Informativa Privacy</label>
</td>
<td>
<textarea name="textarea" cols="75" rows="10" readonly="readonly" id="textarea" style="overflow-y: scroll;">
bla bla bla
</textarea>
</td>
</tr>
<tr>
<td class="key">
</td>
<td>
<input class="required " id="agree" name="agree" type="checkbox" /> <label for="agree"><?php echo JText::_('COM_USERS_REGISTER_PRIVACY_LABEL'); ?>*</label>
</td>
</tr>
<tr><td><p> </p><p> </p></td></tr>
</table>
<?php if($this->K2Params->get('recaptchaOnRegistration') && $this->K2Params->get('recaptcha_public_key')): ?>
<label class="formRecaptcha"><?php echo JText::_('K2_ENTER_THE_TWO_WORDS_YOU_SEE_BELOW'); ?></label>
<div id="recaptcha"></div>
<?php endif; ?>
<div class="k2AccountPageNotice"><?php echo JText::_('K2_REGISTER_REQUIRED'); ?></div>
<div class="k2AccountPageUpdate">
<input class="registrazione" type="button" onclick="return validat(agree)" value="Registrati"/>
<!-- <button class="button validate" type="submit" onclick="ctr(this)" >
<?php //echo JText::_('K2_REGISTER'); ?>
</button> -->
</div>
</div>
<script language="javascript">
function validat(agree){
if (agree.checked != 1){
alert('messaggio di errore');
return false;
} else {return true;}
}
</script>
<input type="hidden" name="option" value="<?php echo (K2_JVERSION=='16')?'com_users':'com_user'?>" />
<input type="hidden" name="task" value="<?php echo (K2_JVERSION=='16')?'registration.register':'register_save'?>" />
<input type="hidden" name="id" value="0" />
<input type="hidden" name="gid" value="0" />
<input type="hidden" name="K2UserForm" value="1" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>