Welcome Guest, Not a member yet? Register   Sign In
Newbie Questions
#4

[eluser]Colin Williams[/eluser]
The thing to see is that the controller function that displays the form and the function that processes the form are one in the same. The difference happens within the condition of validation succeeding or failing. And there are actually three conditions

1.) Validation fails, but there are no errors. This means the page has simply been requested. In this case, we should show a blank form.

2.) Validation fails, and there are errors. This means the user submitted the form, but something was incorrect. In this case, we should reload the form, display the errors, and repopulate the fields with the users submitted values.

3.) Validation passes. This means the user successfully submit the form. In this case, we should save the data using the model, then either generate a page detailing the transaction, or redirect them to a relevant page (like one that shows the object they just created.) I prefer redirecting, and I use session flashdata to store messages.


Messages In This Thread
Newbie Questions - by El Forum - 01-21-2009, 07:23 PM
Newbie Questions - by El Forum - 01-21-2009, 09:49 PM
Newbie Questions - by El Forum - 01-22-2009, 03:26 PM
Newbie Questions - by El Forum - 01-22-2009, 03:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB