[eluser]Future Webs[/eluser]
In building forms there are often cases where a field would be required on insert but not on update.
for example imagine this table
Code:
id
file_field
title
date_added
date_updated
on insert we would require require ® and post these
Code:
file_field (R)
title (R)
date_added (R)
but on update we would only require ® and post these
Code:
file_field
title (R)
date_updated (R)
obviously date_added and date_updated would be set in the controller or model rather then in the form but I put them there to help describe the situation.
How do you guys go about this situation. do you create a new function within your controller to handle either the "insert" or "update" or do you use one function called "form" and use some condition statements that handles what is validated and then put into an array to pass to the database
Hopefully i explained this well enough. Im sure its a common situation and i may be trying to scrimp on not coding but at the same time im trying to avoid repeating any code where possible. The example above has the bare minimum to explain things but in real life my forms / tables are much bigger