Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Form SaveInto


Reply

2 Posts   1486 Views

Avatar
Bambii7

27 November 2010 at 9:52pm Community Member, 254 Posts

Out of curiosity should the folloing work (in a form action)?

      if($member = Member::currentUser()) {
         $form->saveInto($member);
         $member->write();
      }

After submiting a basic form with new TextField("FirstName", "First name", $member->FirstName)
Or do I have to go
$member->FirstName = $data->FirstName;
$member->write();

Avatar
Bambii7

27 November 2010 at 10:18pm Community Member, 254 Posts

Right as expected it does work why my tests weren't working was I had a datefield casing issues

$dateField = new DateField('DOB', "Date of birth", $member->DOB);
$dateField->setConfig('dmyfields', true);