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

Editing a multiform table




Community Member, 153 Posts

9 April 2010 at 1:04pm


Could anyone shed some light on this maybe? I have a multiform on a site I've built which now needs the functionality to edit those entries via the front end. Before you ask, security is not a primary issue here as this is an application used on an intranet.

Below I have posted my code, I have so far managed to display my data rows in a table with links to 'view full details' and 'edit details'. When I edit, a form displays, but when I hit submit the page goes blank and in the URL I am getting the function for the form appended to the URL.

Why is this happening?


Note: I have only attempted to edit one of the tables for simplicity at this stage until I get this working.


class CallerDatabase extends Page{

class CallerDatabase_Controller extends Page_Controller{

   public function getIndividualCallDetails(){

   if($URLAction = Director::URLParam('Action')){
   $CallEventID = Convert::raw2xml($URLAction);
         return DataObject::get_by_id('CallEvent', $CallEventID);

      public function EditCallEvent(){
         $urlAction = Director::urlParam('Action');
         $desiredAction = 'editcall';
         if($urlAction == $desiredAction){
            $fields = new FieldSet(
               new TextField('CallerFirstName', 'Callers first name')
               new TextField('CallerSurname', 'Callers Surname')
               new TextField('CallerFirstAge', 'Callers age')

            $actions = new FieldSet(
               new FormAction("UpdateCallEvent", "Update")

            return new Form($this, "EditCallEvent", $fields, $actions);

      public function UpdateCallEvent($data, $form){

         if($urlAction == $desiredAction){

            if($urlID = Director::urlParam('ID')){
               $CallEventID = Convert::raw2xml($urlID);

            $CallEvent = DataObject::get_by_id('CallEvent', $CallEventID);
            if($CallEvent) {
               $CallEvent->CallerFirstName = $data['CallerFirstName'];
               $CallEvent->CallerSurname = $data['CallerSurname'];
               $CallEvent->CallerAge = $data['CallerAge'];

   public function Success(){
      return isset($_REQUEST['success']) && $_REQUEST['success'] == "1";