Welcome Guest, Not a member yet? Register   Sign In
Repopulating HTML form using DMZ extension htmlform

Can any1 tell me how could I repopulate form when usin DMZ extension htmlform.

Please explain


The provided example form templates are setup for this already, I believe. All you have to do is call render_form() on a populated item. For instance:

$user = new User();

// show a form to create a new user
echo $user->render_form();

// show a form populated with existing user data
$admin = new User();
$admin->where('username', 'admin')->get();

echo $admin->render_form();

Now if you want to repopulate a form that failed validation, it goes something like this:

// if create user form posted...
$user = new User();

if ($user->save())
// saved
// failed validation

// this works because $user is still loaded from $_POST

Theme © iAndrew 2016 - Forum software by © MyBB