Welcome Guest, Not a member yet? Register   Sign In
A question about views and form validation.
#1

[eluser]kyleect[/eluser]
I'm still very new to MVC and CI and I've come across an issue. Ok, lets say we have...

http://domain/form

and it has two text inputs, "foo" and "bar". I need to make sure both have text. When you submit the form, it goes to

http://domain/form/process

My controller is checking to see if the inputs are filled out and lets say "foo" isn't filled out. How do I redirect back to http://domain/form with an error message? What I've been doing is creating a view with the message but this seems extremely sloppy and makes me uncomfortable. I know there has to be a better way of doing this. Should I have that kind of logic in the view? That seems to defeat the purpose. Can anyone offer any suggestions?
#2

[eluser]jalalski[/eluser]
Have you looked into the Form Validation helper? That's the 'standard' way to do it in CI.




Theme © iAndrew 2016 - Forum software by © MyBB