Welcome Guest, Not a member yet? Register   Sign In
Using one controller/method to validate and send different types of data to model
#1

[eluser]skunkbad[/eluser]
I have used a config file to change form validation rules dynamically, but after validation succeeds, I'm wondering what my best option is for sending the different data sets to the model for insert or update. In a simple form validation example, the form validation is run, and if not FALSE, then set_value() can be applied to array members that are passed to the model for insert/update. What I want to do is dynamically change that array. For instance, if I was validating the post, and it had post keys a, b, and c, then route to model->insert( $insert_array, $type). If the post keys had d, e, and f, then I'd change the $type. What I'm wondering about is setting up the array from set_value()s. Do you think it is appropriate to send the array to the model and have it sort out everything, or would it be better to do it in the controller? There are many $types that need to be sorted out, so I'm just wondering if anyone has any advice. What I don't really want to do is have my controller grow by a few hundred lines trying to sort out all of these things, but then I don't really want it all in the model either!


Messages In This Thread
Using one controller/method to validate and send different types of data to model - by El Forum - 04-17-2011, 10:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB