I'am having an issue with clearing a form field before I render the field. In this case I have created a new form element using the $user as entity. When the form is renderd I like the password field to be an empty string instead of the password has that is stored in the $user entity. The clear below is not working.
public function editAction( $id )
{
$user =Users::findFirst( $id );
$form =new UserForm( $user );
$form->clear( 'password' ); // <-- I like for the password field to be empty
if( $this->request->isPost())
{
$form->bind( $this->request->getPost(), $user );
if( $form->isValid( ))
{
$result =$user->update( );
if( $result )
{
$this->response->redirect( '/backend/users/' );
return false;
}
else
{
die( 'error1' );
}
}
else
{
die( 'error2' );
}
}
$this->view->setVar( 'form', $form );
}