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

Update table in database with populated user form


Go to End


2 Posts   3040 Views

Avatar
Todd

31 Posts

14 September 2009 at 7:29pm

Hi All,

I can populate a user form and I now how to submit it into a table i the database, but how do I update with the information I retrieved? This is assuming I make a change to one of the populated fields, like correcting a spelling error or modifying a date.

I use this function to submit new info to the database:

function submitform($data, $form) {

// Create a new Member object and load the form data into it
$submission = new StudentData();
$form->saveInto($submission);

// Write it to the database. This needs to happen before we add it to a group
$submission->write();

Director::redirectBack();

}

I'm guessing a fairly simple modification of the function above will allow me to update my table with my currently populated fields.

Thanks in advance.

Avatar
JimAasheim

Community Member, 12 Posts

31 January 2010 at 3:36am

Hey,
that's exactly my problem as well.
I'd be glad for the hint also.

I see that the objects ID is not available in the form (if I force it then I get a dropdown list with all IDs (or actually filled with the return values of the getTitle() function).

I also noticed there's a SecurityID field - but I couldn't yet find out about its meaning.

Well, I'll post here as I find the solution... before someone else posts it... ;-)