【发布时间】:2015-06-14 07:55:18
【问题描述】:
HTML 查看表单
<div class="form-group">
<div class="col-lg-4">
<input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('keywords[]'); ?>" placeholder="Tag or Keyword" />
</div>
<div class="col-lg-4">
<input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('keywords[]'); ?>" placeholder="Tag or Keyword" />
</div>
<div class="col-lg-4">
<input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('keywords[]'); ?>" placeholder="Tag or Keyword" />
</div>
<div class="col-lg-4">
<input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('keywords[]'); ?>" placeholder="Tag or Keyword" />
</div>
<div class="col-lg-4">
<input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('keywords[]'); ?>" placeholder="Tag or Keyword" />
</div>
<div class="col-lg-4">
<input type="text" name="keywords[]" class="form-control input-sm" tagchecker="alphanumeric" value="<?php echo set_value('keywords[]'); ?>" placeholder="Tag or Keyword" />
</div>
</div>
在我的控制器中
$this->form_validation->set_rules('keywords[]', 'Keyword or Tags', 'xss_clean|alpha_dash');
实际问题,
以上所有关键字数组的输入文本都不是强制性的(控制器中没有应用必需的规则),但如果用户输入的不是alpha_dash,Codeigniter 应该只显示该字段的验证错误。它不应该显示空白字段的错误。
如果我写一个回调,我该如何管理return FALSE and error message for particular text box?
我怎样才能做到这一点?有什么建议么? 谢谢
【问题讨论】:
标签: php codeigniter