Welcome Guest, Not a member yet? Register   Sign In
Form Validation
#1

(This post was last modified: 08-04-2015, 11:15 AM by ignitedcms.)

I kinda already know the answer to my question but I'll ask it anyway.

I've been using javascript to validate my forms and as a result I've been a bit lazy on server side validation. I thought if I make the field mandatory in the javascript I don't have to check it server side, which is probably a bad idea. But I'll ask the question anyway, should you always be validating form data server side?

But my other question was on repopulating the form with old data that was incorrect.

How best to do this efficiently?

At the moment my form is validated and if it is bad data instead of loading all the views again I just do

Quote:redirect("my_controller/my_method", "refresh");

I would like to use the above method as it save having to type out all the view files which the redirect method calls anyway. For example:

Code:
$this->load->view('header');
$this->load->view('body');
$this->load->view('content');
$this->load->view('footer');


But how to I pass the bad data as 'flash data' back into the view? I've never been able to do this correctly. And what happens on first load, would you need to use an isset() in the view?

An example would be great.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply


Messages In This Thread
Form Validation - by ignitedcms - 08-04-2015, 11:11 AM
RE: Form Validation - by mwhitney - 08-04-2015, 01:36 PM
RE: Form Validation - by Diederik - 08-04-2015, 03:02 PM
RE: Form Validation - by ignitedcms - 08-04-2015, 03:40 PM
RE: Form Validation - by Diederik - 08-04-2015, 10:36 PM
RE: Form Validation - by ignitedcms - 08-05-2015, 12:08 AM
RE: Form Validation - by mwhitney - 08-05-2015, 07:26 AM
RE: Form Validation - by Diederik - 08-05-2015, 01:43 AM
RE: Form Validation - by Wouter60 - 08-05-2015, 06:50 AM
RE: Form Validation - by CroNiX - 08-05-2015, 07:20 AM
RE: Form Validation - by ignitedcms - 08-05-2015, 11:55 AM
RE: Form Validation - by mariek - 08-14-2015, 08:40 AM
RE: Form Validation - by mwhitney - 08-14-2015, 09:54 AM
RE: Form Validation - by mariek - 08-17-2015, 12:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB