Hello,
I have a data looks like :
{ "_id" : ObjectId("5485fff9cd4c5357388b4567"),
"email" : "[email protected]", "password" : "$2a$08$ViYRn3IqwbjbF5MrAuatBOAOyopqVOuoKo7HBavBcp6ZfGV/3s7ky",
"name" : "my name",
"profile" : {
"name" : "comp",
"state" : "AK",
"city" : "city",
"zip" : "07009" },
"d_created" : "", "d_changed" : "" }
I'm trying to create a custom form to modify that data.
class ProfileForm extends Form
{
public function initialize($entity = null, $options = null)
{
$name = new Text('name', array(
'placeholder' => 'name',
'class' => 'form-control'
));
$email = new Email('cmp-city', array(
'placeholder' => 'Email',
'class' => 'form-control'
));
/// validators go next
In controller file :
$user = User::findFirst(array(
array('email' => $this->session->get('auth')['email'])
));
$form = new ProfileForm($user);
If form is not submitted yet, the fields will be prefilled with the data from $user...
But I'm not sure how to create a field with prefilled data: $user->profile['name'] ?