Combine Edit & Input Views |
[eluser]scottelundgren[/eluser]
Is there an elegant way for a view to be used for both data entry of a new record and editing an existing record? I'm trying to add the following logic. If you see a good way to combine these samples of 2 views into 1 view and retain validation I'd appreciate it. Thanks! look up student record if a record is found, load the data from the row into $data, pass $data into the view: Code: <tr> Code: <tr>
[eluser]Pygon[/eluser]
you could embed an if statement, such as: Code: <td align="center" valign="middle">
[eluser]Negligence[/eluser]
I set a mode flag (to create or edit) and determine what to show/hide depending on the flag. Same goes for validation.
[eluser]Craig A Rodway[/eluser]
This is something I have used since I started with CI and subsequently wrote this article in the wiki. Hope it helps.
[eluser]scottelundgren[/eluser]
Ah! That should do it. Thanks! [quote author="Pygon" date="1199397555"]you could embed an if statement, such as: Code: <td align="center" valign="middle">
[eluser]scottelundgren[/eluser]
[quote author="Craig Rodway" date="1199404269"]This is something I have used since I started with CI and subsequently wrote this article in the wiki. Hope it helps.[/quote] That article was helpful. Unfortunately my app is a series of post forms because I have to carry multiple variables so I can't use the uri segment code like the example but I get the gist of the fields function that encapsulates the suggestion of Pygon. |
Welcome Guest, Not a member yet? Register Sign In |