Welcome Guest, Not a member yet? Register   Sign In
Dynamic class: Form Validation
#3

[eluser]Samus[/eluser]
[quote author="achilleusrage" date="1331257658"]One thing you could do is check for some other input (a hidden field) that flags if your form has been submitted. Then, if that flag exists, do your if your check to determine which CSS class to show.[/quote]
Now that you mention that, I just thought of running a check to see if anything was posted before going on to do the validation check.

Thanks!

Updated code in case anybody has a similar issue:

Code:
<span class="formf &lt;?= ($this-&gt;input-&gt;post() ? (form_error(('content')) ? "control-group error" : "control-group success") : ""); ?&gt;">    
    &lt;?=form_label('Content', 'fcontent');?&gt;
    &lt;?= form_error('content', '<div class="error_message">', '</div>'); ?&gt;
    &lt;?=form_textarea(array('name' => 'content', 'value' => set_value('content'), 'id' => 'fcontent', 'rows' => 3, 'title' => 'Content shit here'));?&gt;
</span>


Messages In This Thread
Dynamic class: Form Validation - by El Forum - 03-08-2012, 05:53 PM
Dynamic class: Form Validation - by El Forum - 03-08-2012, 06:47 PM
Dynamic class: Form Validation - by El Forum - 03-08-2012, 06:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB