Welcome Guest, Not a member yet? Register   Sign In
Form validation in codeigniter does not seem DRY
#6

(10-24-2015, 03:53 PM)iamthwee Wrote: There's some good point brought up here guys! I never thought of creating conditional logic for both insert and update. Although I'm not quite sure it would work in the view files as it is quite complicated and separating does lend itself for easier amends.

@paul yes you can custom call backs but this is only for one _post variable, you can't write a custom call back for two posts or more (where one post is very much dependant on the other) as brought up by narf.

Therefore the only way to circumvent this is to do your own validation and use flashdata to flash a message when you reload the view again for this particular case.

You don't place the conditional logic in the view. Your view is the form, and this form is the same for inserting, updating and correcting on failed validation.

In which scenario would you need to process more than one _post variable?
Reply


Messages In This Thread
RE: Form validation in codeigniter does not seem DRY - by Martin7483 - 10-24-2015, 11:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB