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.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Userforms Submission URL


Go to End


4 Posts   2254 Views

Avatar
Liam

Community Member, 470 Posts

2 October 2012 at 10:05am

I just want to add an anchor ID to the URL so it will reload back to the form area on the page.

I solved this for successful submissions.

UserDefinedForm.php line 856:
return $this->redirect($this->Link() . 'finished' . $referrer . '#singleColumn');

But for forms with errors (blank required fields), I can't get it working.

line 718

if(Session::get("FormInfo.{$form->FormName()}.errors")){
			Controller::curr()->redirectBack();
			return;
		}

No matter what I change redirectBack(); too, nothing changes.

Avatar
juneallison

Community Member, 110 Posts

27 September 2013 at 9:10am

Did you ever find a solution? I'm working on a similar scenario where I need to control where the user ends up. Thanks!

Avatar
Liam

Community Member, 470 Posts

27 September 2013 at 1:05pm

I did but I can't remember to be honest. It was a long time ago and we've since updated the code and there wasn't a need for it anymore.

But search UserDefinedForm.php for the line return $this->redirect($this->Link() . 'finished' . $referrer and change it to what you need as that's where the redirect happens.

Avatar
juneallison

Community Member, 110 Posts

28 September 2013 at 7:12am

Liam - Thank you for your reply anyway! I did find that line of code but my situation is kind of complex. I posted a new thread about it here: http://www.silverstripe.org/all-other-modules/show/25151#post324521

Hopefully I'll find some sort of solution.

Thanks!