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

[eluser]Tim Brownlaw[/eluser]
[quote author="riwakawd" date="1399594339"]
I want to be able to do it via server side can do it with input highlighted 'has-error' but the only issue I am having, is if input is filled in correct should be highlighted 'has-success'.

Currently when use this <?php echo (validation_errors() != '')? 'has-error':'has-success'; ?> makes the input always highlighted 'has-success' when no error.

if there was away to addClass and removeClass using that would be good. Working like the javascript but using codeigniter validation.[/quote]

That is correct!

So let's see... You only want the success or fail class to be "inserted" After the form has been posted/submitted?

So where does that happen? And that is where you would set your class values...

As another hint... you'd could have...
In your Form View
Code:
<div&lt;?php echo $div_name_class;?&gt;> Stuff here </div>

Then in your Controller - check to see.
1. If the Form is submitted AND it's a success
Code:
$form['div_name_class'] = ' class="my-success-class"';
2. if the Form is submitted AND it's a fail...
Code:
$form['div_name_class'] = ' class="you-muffed-it-fella-class"';
3. The Form is NOT Submitted
Code:
$form['div_name_class']  = '';

Of course you can do more clever things in achieving that, but that's the basics!

Cheers
Tim




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