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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Form SaveInto


Go to End


2 Posts   3274 Views

Avatar
Bambii7

Community Member, 254 Posts

27 November 2010 at 9:52pm

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

Community Member, 254 Posts

27 November 2010 at 10:18pm

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);