Welcome Guest, Not a member yet? Register   Sign In
Help keeping my views DRY when using validation library.
#1

[eluser]Unknown[/eluser]
Hi,

I am doing some form validation using the validation libs.

I have a bunch of the usual CRUD views.

To keep things DRY I share the same form for Adding and Updating.

When using the validation lib I have to populate the form values using:

Code:
... value="<?php echo( $this->validation->title) ?>"/>

and so on...

When Updating an object these values are populated from some other data source so the above method does not work. I.e. The initial values come from a model object passed to the view and not the validation object.

How would one do this so I can share the same form and have validation... I could examine the validation object prior to populating each field, like:

Code:
... value="<?php echo( $this->validation->title?$this->validation->title:$title) ?>"/>

but I can't help think there must be a better way.

Any suggestions would be good.

Thanks
Paul


Messages In This Thread
Help keeping my views DRY when using validation library. - by El Forum - 12-21-2009, 12:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB