Welcome Guest, Not a member yet? Register   Sign In
[Closed] Codeigniter Validation Question
#7

[eluser]riwakawd[/eluser]
[quote author="ivantcholakov" date="1399540972"]jquery.validate plugin is nice, I used it as an addition to the server-side validation. But lately I conserve my time and I only implement the PHP-side validation, because it is the secure one.

In CodeIgniter I use only the "has-error" class which is triggered when validation fails on a specific field.

Code:
<div class="form-group&lt;?php if (!empty($validation_errors['username'])) { ?&gt; has-error&lt;?php } ?&gt;">
                    <label for="username">* <i18n>ui_username</i18n></label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fa fa-user fa-fw"></i></span>
                        &lt;input type="text" name="username" id="username" class="form-control" value="&lt;?php echo set_value('username'); ?&gt;" /&gt;
                    </div>
                </div>

$validation_errors is an array here. In CodeIgniter 3 it can be taken this way: $validation_errors = $this->form_validation->error_array();[/quote]

The reason why I used my javascript I found today is because it has both classes error and success. I had to add change it to work with bootstrap 3 and codeigniter. The way that @Tim Brownlaw was OK but has-success was staying there. The javascript only add class when OK.


Messages In This Thread
[Closed] Codeigniter Validation Question - by El Forum - 05-07-2014, 10:49 PM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 12:50 AM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 01:21 AM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 01:39 AM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 01:52 AM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 02:22 AM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 02:35 AM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 12:26 PM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 05:12 PM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 05:27 PM
[Closed] Codeigniter Validation Question - by El Forum - 05-08-2014, 11:56 PM
[Closed] Codeigniter Validation Question - by El Forum - 05-09-2014, 03:10 AM
[Closed] Codeigniter Validation Question - by El Forum - 05-09-2014, 05:55 AM
[Closed] Codeigniter Validation Question - by El Forum - 05-10-2014, 01:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB