Welcome Guest, Not a member yet? Register   Sign In
Do YOU use CodeIgniter's form helpers?
#5

[eluser]Calvin Froedge[/eluser]
Quote:I validate with MooTools Formcheck, put my PHP validation rules in a config file and run the tests against that. I haven’t found a simple way of populating the fields again if there is a validation error though.

Use set_value, it's built into the form validation class:

For adding new entities:

Code:
<input type="text" class="text" name="coupon_type_name" value="<?php echo set_value('coupon_type_name');?>" />

For editing existing:

Code:
<input type="text" class="text" name="coupon_name" value="<?php echo (set_value('coupon_name') == $coupon_info->coupon_name OR set_value('coupon_name') == '') ? $coupon_info->coupon_name : set_value('coupon_name'); ?>" />

Note that you'll need to use different values than the ones I've got in there (for coupon codes) = ) Let me know if you need further explanation.


Messages In This Thread
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 09:43 AM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 09:50 AM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 10:58 AM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 12:01 PM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 02:03 PM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 04:08 PM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 04:22 PM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 04:44 PM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 05:22 PM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 05:24 PM
Do YOU use CodeIgniter's form helpers? - by El Forum - 02-16-2011, 05:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB