我加上Jquery,可以点了,但验证有问题后不弹起来,我点不了。 什么哦?没有看明白你的啥意思 smartweb 发表于 2011-6-17 17:12 static/image/common/back.gif
我加上Jquery,可以点了,但验证有问题后不弹起来,我点不了。
上 C V代码...
不清楚你页面和控制器到底是怎么处理的. captcha不错简单易行 我摘片段:
Control:
$this->load->library('email');
$this->load->library('form_validation');
$this->form_validation->set_message('required', $tip_required.':%s');
$this->form_validation->set_message('valid_email', $tip_email);
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$this->form_validation->set_rules('topic', $topic, 'trim|required');
$this->form_validation->set_rules('name', $yourname, 'trim|required');
$this->form_validation->set_rules('email','E-mail', 'trim|required|valid_email');
$this->form_validation->set_rules('im', 'MSN/QQ', 'trim|required');
$this->form_validation->set_rules('address', $address, '');
$this->form_validation->set_rules('tel', $tel, 'trim|required');
$this->form_validation->set_rules('contents', $contents, 'required');
$this->form_validation->set_rules('captcha', $tip_captcha, 'required|callback_captcha_check');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('template/sendmail',$data);
}
else
{//mail使用163.com发邮件,略
$this->load->view('template/sendmail_ok',$data);
}
function captcha_check($str)
{
if (strtolower(trim($str)) != $_SESSION['captcha'])
{
$this->form_validation->set_message('captcha_check', '%s');
return false;
}else
{
return true;
}
}
+++++++++++++++
View:
<script>
function onsub(){
$('#sub').attr("disabled",true);
}
</script> <form method="post" action="">
E-mail:<input name="email" type="text" id="email" size="40" value="<?php echo set_value('email');?>" /><input style="border: 1px solid #ddd;background-color: #fefefe;width:200px" type="text" name="captcha" id="captcha-form" value="" /><br />
<a class=redfont href="#" style="text-decoration:none;" onClick="
document.getElementById('captcha').src='<?=base_url()?>public/js/captcha/captcha.php?'+Math.random();
document.getElementById('captcha-form').focus();"
id="change-image"><img src="<?=base_url()?>public/js/captcha/captcha.php" id="captcha" /><inputid='sub' class='commentbu' type='submit' value='Submit' onclick='onsub()' />
<input type='reset' name='button' id='button' value='Reset'></form>
+++++++
我是多语言后台的,代码我尽量简化了。 表单令牌啊,这个可以的
页:
1
[2]