[eluser]JasonS[/eluser]
Hey, this may have been answered before but I have a question about generating forms.
I have 3 form fields.
Username, Email and Password.
I want, by default for the password field to be blank. (Currently it fills with the sha1 key
)
Then, if the password field is empty I do not want the field to be updated.
This is where I am little confused.
Where do I start on this? This is what I have.
Code:
public function edit($id)
{
$user = $this->user->find($id);
if ( ! $user)
{
echo 'User not found';
return;
}
if ($user->validate(array('username', 'email')))
{
$user->save();
}
echo $user->form();
if ($_POST)
$this->index(); // Buggy - Fix
}
Code:
class User extends IgnitedRecord
{
var $act_as = array (
'validation' => array (
'username' => array (
'rules' => 'required|min_length[3]',
'desc' => 'The username'
),
'email' => array (
'rules' => 'required|email',
'desc' => 'The E-Mail'
),
'password' => array (
'rules' => 'required|min_length[6]',
'desc' => 'The Password'
)
)
);
}
Basically. I have 3 questions.
How do I make the password field a password field?
How do I make the password field blank?
How do I check to see if the password field has been filled and update it? (I don't want to accidently update the password and wipe it.)
Thanks