Welcome Guest, Not a member yet? Register   Sign In
Editing a form - CI strategy
#3

[eluser]Phil Sturgeon[/eluser]
[quote author="Goo Theory" date="1187864279"]... you can simply test the 2nd segment of the URI to vary the rules.

You can also use test the 2nd segment of the URI from the view itself to add/remove certain form elements depending on whether the URI is for a 'new' record or to 'edit' an existing record.[/quote]

That's one way but if you find you are making way to make if statements to check if its add or edit, try using totally different methods. You will find yourself using some repeated code but as time goes on you will find it more manageable as you can add in bits and take bits out without worrying about the affect on the other.

You can still use the same view doing it this way. I just output a variable like:

Code:
$data['form_action'] = 'add';
// or
$data['form_action'] = 'edit/'.$itemID;


Messages In This Thread
Editing a form - CI strategy - by El Forum - 08-22-2007, 09:09 PM
Editing a form - CI strategy - by El Forum - 08-22-2007, 11:17 PM
Editing a form - CI strategy - by El Forum - 08-23-2007, 04:38 AM
Editing a form - CI strategy - by El Forum - 08-23-2007, 05:30 PM
Editing a form - CI strategy - by El Forum - 08-24-2007, 11:18 AM
Editing a form - CI strategy - by El Forum - 08-27-2007, 04:24 PM
Editing a form - CI strategy - by El Forum - 08-27-2007, 04:31 PM
Editing a form - CI strategy - by El Forum - 08-27-2007, 04:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB