2012-10-16 3 views
0

Я использую joomla 1.5, вам необходимо добавить флажок с указанием условий. Я использовал приведенный ниже код, но он не работал полностью. его предупреждение даже у меня есть галочка.Joomla Регистрационная форма с условиями и условиями Флажок

<script type="text/javascript"><!-- 

function checkAgree() { 
    var agree = document.getElementById('formAgree');   
    if (!agree.checked) { 
     alert('To become a member you must agree to our terms of service!'); 
     return false; 
    } 
    return true; 
} 

--></script> 
<form action="<?php echo JRoute::_('index.php?option=com_user'); ?>" method="post" id="josForm" name="josForm" class="form-validate" onsubmit="return checkAgree();"> 

<?php 

// Terms of Service 

$tokenHTML = str_replace('type="hidden"','id="formAgree" type="checkbox"',JHTML::_('form.token')); 

$tosURL = "tos.html"; // REPLACE THIS! 

?> 
<tr> 
    <td height="40" style="vertical-align: top;"> 
     <label> 
     Terms of service:   
     </label> 
    </td> 
    <td> 
     <iframe src="<?php echo htmlentities($tosURL); ?>" width="307" height="150"></iframe> 
    </td> 
</tr> 
<tr> 
    <td colspan="2"> 
    <p><?php echo $tokenHTML; ?> <b>Agree to terms of service.</b> *</p> 
    </td> 
</tr> 
<tr> 
+0

Любая помощь может быть в такого рода проблемы? –

+0

Каково значение 'соглашаться' в' checkAgree() 'function ?? проверьте консоль. –

ответ

0
if ($("#formAgree").not(":checked")) { 
    alert('To become a member you must agree to our terms of service!'); 
    return false; 
} 
return true; 
Смежные вопросы