Welcome Guest, Not a member yet? Register   Sign In
Reusing the same form code for creating and editing
#2

[eluser]Rick Jolly[/eluser]
I just live by this:

If the form has not been posted, then prepopulate the validation object.

That way, for example,
Code:
value="<?= $this->validation->name; ?>
will always have a value and your views will be cleaner.

This will work for editing or adding an object. So if you are editing there will be an object id sent to the controller. Otherwise assume you are adding an object and just initialize the validation object with blank and/or default field values.


Messages In This Thread
Reusing the same form code for creating and editing - by El Forum - 06-24-2007, 11:42 AM
Reusing the same form code for creating and editing - by El Forum - 06-24-2007, 01:52 PM
Reusing the same form code for creating and editing - by El Forum - 06-24-2007, 06:58 PM
Reusing the same form code for creating and editing - by El Forum - 10-01-2007, 10:25 AM
Reusing the same form code for creating and editing - by El Forum - 10-01-2007, 11:56 AM
Reusing the same form code for creating and editing - by El Forum - 10-01-2007, 12:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB