Jump to:

23478 Posts in 18950 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Form SaveInto

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

Page: 1
Go to End
Author Topic: 1464 Views
  • Bambii7
    Avatar
    Community Member
    254 Posts

    Form SaveInto Link to this post

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

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Form SaveInto Link to this post

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

    1464 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.