简体   繁体   English

在jQuery Tabs UI中实现Codeigniter验证

[英]Implementing Codeigniter validation into jQuery Tabs UI

I'm not sure if its already been done but I am trying to implement Codeigniter validation rules to 'hook' into the jQuery Tabs UI for a backend I'm producing. 我不确定它是否已经完成,但是我正在尝试实现Codeigniter验证规则,以“挂钩”到我正在生成的后端的jQuery Tabs UI中。

Does anyone know if somebody has already achieved this - it would be nice for the form validation to indicate a particular tab has errors on the tab with the form submission. 有谁知道是否有人已经做到这一点-表单验证最好指出特定的选项卡在提交表单的选项卡上有错误。

Can anyone suggest any ideas? 有人可以提出任何想法吗? Thanks 谢谢

This would very simple to achieve, say you have a tab with 3 fields (field1, field2 and field3) you would writhe something like this: 这将非常简单地实现,例如,您有一个包含3个字段(field1,field2和field3)的选项卡,您将使用以下内容:

 <div id="tabs">
  <ul>
    ...
    <li <?=form_error(field_1) || form_error(field_2) || form_error(field_3) ? 'class="error"' : ''?>><a href="#tab-n">Tab with errors</a></li>
    ...
  </ul>
  ...
  <div id="tab-n">
    <?=form_input('field_1')?><?=form_error(field_1)?>
    <?=form_input('field_2')?><?=form_error(field_2)?>
    <?=form_input('field_3')?><?=form_error(field_3)?>
  </div>
  ...
</div>

And then style the tab(s) with the .error to give a visual clue that it contains errors. 然后使用.error设置选项卡的样式,以直观地提示它包含错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM