DMZ 1.7.1 (DataMapper OverZealous Edition) |
[eluser]OverZealous[/eluser]
[quote author="lsemel" date="1273112453"]I had a some cases where I wanted to keep the bulk of the validation rules within my models, but add others for other fields that exist on the form but don't correspond to one in a model...[/quote] Seems like you know this, but you can add validation for "virtual" fields, like the confirm_password example. However, they can get in the way when you don't need them. Quote:And didn't want to manually copy all the fields from the form into my model with a bunch of $model->whatever = $this->input->post('whatever') See the Array extension, using from_array! ;-) Quote:And wanted to display errors, wherever they came from, using the same code <?= form_error('field') ?> in my views, and not have the views worry about whether an error comes from the form validation class or DataMapper. You also can add your own errors to the object's error, using error_message. This might help, as well. (You can get a specific error message using object->error->{$field}.) |
Welcome Guest, Not a member yet? Register Sign In |