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.

Template Questions /

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

Simple POST method with SS_HTTPrequest example ? Any official Tutorial ?


Go to End


6 Posts   2097 Views

Avatar
Digitweaks

Community Member, 11 Posts

13 March 2015 at 4:41am

Is there anywhere on the web a single easy to understand example on how to pass variable from a page to another ?

Just willing to use POST but there's no example on SS3 and looks like nobody talks about it.
It's an usual case when it comes to build websites so i don't understand that i can't find anything like an official tutorial

Avatar
Pyromanik

Community Member, 419 Posts

13 March 2015 at 4:49am

Edited: 13/03/2015 4:58am

Avatar
Digitweaks

Community Member, 11 Posts

13 March 2015 at 6:48am

Thanks for the answer.

The main problem is not to find this type of information but how it works. I searched everywhere and can't find an updated and clear answer of the process.
I tried to route a function since hours and it doesn't work. I feel like most examples depends on versions that are outdated and don't know where to put my head in to begin with. I find some posts but from 2009 then another information from 2011 but nothing is clear on what really works on the SS3 latest version. I love SS but the lack of clear example from A to Z really drive me insane. I wish SS could have a really simple documentation that goes straight to the point.

Avatar
zenmonkey

Community Member, 545 Posts

18 March 2015 at 3:36am

The new documentation site is getting better. UncleCheese is currently writing new tutorials (with video) on how to do things. http://www.silverstripe.org/learn/lessons/

The actual code is fairly well documented so I usally end up digging the api.silverstripe.org

Avatar
wmk

Community Member, 87 Posts

18 March 2015 at 4:59am

POST is good for passing data from a form to a controller action.

For routing I'd use GET... though there might be edge cases where it's not so good...

If you can describe what you want to acchive and paste some code we probably can help you better.

Routing can be difficult to debug, it needs the route defined in yml, the action defined in controller's $allowed_actions array, and - as both is cached - a ?flush to get the changes working.

Avatar
Digitweaks

Community Member, 11 Posts

18 March 2015 at 12:32pm

Hi, thank you all for your answers, i finally managed to make it works with a simple Session::set(value) then Session::get(Value)

I think the worst is to realize once it's done how easy it is to do with basically two lines of code.
I had to pass the ID of a page so the next page that as a form can retrieve the value and fill a form depending on the ID and current user, it was simple as that.