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

Something changed?


Go to End


2 Posts   957 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
bummzack

Community Member, 904 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'))
	);
}