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

Something changed?


Reply


2 Posts   655 Views

Avatar
Victor

Community Member, 128 Posts

18 November 2009 at 12:36am

I have not touched this project for eternity and this thing worked in 2.3.0 but not in 2.3.3

<?php
class SeminarAll extends Page {
static $db = array(
);
}

class SeminarAll_Controller extends Page_Controller {

function SeminarSearchFormAll(){
return new Form(
$this,
"SeminarSearchFormAll",
new FieldSet( new FormAction('doSeminarSearchAll','Display All Seminars'))
);
}

function doSeminarSearchAll($data,$form){
$results = new DataObjectSet();
$resultss = DataObject::get("Seminar", "", "`seminardate`,`seminartimestart`");
$results->merge($resultss);
$results->sort('seminartimestart');
$results->sort('seminardate');
return $this->customise(array('SeminarSearchResults' => $results))->renderWith(array('SeminarSearch_results'));
}
}
?>

It complains (in DevMode) about

function doSeminarSearchAll($data,$form){

but would not complain about
function doSeminarSearchAll(){

(albeit the latter does not work)

Anything I am missing? Thank you in advance

Victor

Avatar
banal

Community Member, 901 Posts

18 November 2009 at 2:56am

The form actions should be the fourth parameter of the Form constructor (not the third as in your example).
http://doc.silverstripe.org/doku.php?id=form

function SeminarSearchFormAll(){
   return new Form(
      $this,
      "SeminarSearchFormAll",
      ... your form fields? ...,
      new FieldSet( new FormAction('doSeminarSearchAll','Display All Seminars'))
   );
}