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

SS3 - Ajax - Form - Session timed out


Go to End


2 Posts   1586 Views

Avatar
Lukin

Community Member, 56 Posts

4 November 2012 at 5:08am

Hi

I try to load a form from my pagecontroller via an ajaxrequest.
->mypage/UploadForm

As an answer I get the error message : "Sorry, your session has timed out."

My code:

	public static $allowed_actions = array (
		'UploadForm'		
	);
	
	public function UploadForm(){
		$thumbField = new UploadField('ProfilePicture', 'Profile picture');
	    $thumbField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
	    $thumbField->setConfig('allowedMaxFileNumber', 10);
		$form = new Form (
			$this,
			"ApplyForm",
			new FieldList (
				//$thumbField
			),
			new FieldList (
				new FormAction('doApply', _t('Angebot.APPLYNOW','Angebot senden'))
			)

		);
		return $form;		
	}

Don't know what to do.
An help appreciated ;)

Thx in advnace
Lukin

Avatar
Sean

Forum Moderator, 922 Posts

6 November 2012 at 1:17pm

Hi there,

You need to ensure the SecurityID hidden field in the form is also passed when submitting the form via AJAX.

Cheers,
Sean