Welcome Guest, Not a member yet? Register   Sign In
best practices on Form Reuse - keeping all forms in a central location with validation
#47

[eluser]chuckleberry13[/eluser]
K, I see what you mean. Correct me if I am wrong, but basically what we are looking for is a data bank of all the possible data elements that could be requested in a form. That central data bank would then handle the validation and data prep functions.

I think the concept finally clicked. I thought of another reason why this would really be helpful. In my particular case I have tons and tons of form elements that are formatted in real-time with JavaScript to currency numbers (i.e. $10,000.00). Every time I store one of these elements in the db I have to clean them and strip them of their formatting (i.e. 100000). By having the data bank handle everything, I just need have it run those form elements through a comma stripping function every time that element is requested and submitted in a form and it doesn't care when or where the form is displayed. That would be sweet.

So JoostV's library has you create the array with the validation rules and everything in the controller and not storing the rules in a data bank like you are suggesting so that wouldn't work right? (@JoostV - seems like a great library and has given me some ideas already so I'm not saying anything negative about your library).

I went back and looked at your plugin and after our discussion I can now see more clearly what you are saying. One thing though, you said since you passed in the CI super object to your plugin, you can see what form elements are being included. How exactly do you do that? How do you search through the super object and see what form elements are being used?


Messages In This Thread
best practices on Form Reuse - keeping all forms in a central location with validation - by El Forum - 07-26-2008, 05:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB