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

$url_handlers and forms?


4 Posts   207 Views


30 August 2014 at 4:49am Community Member, 145 Posts

I'm having a problem getting my form action to process, my url handlers look like this:

private static $url_handlers = array(
'//$Action/$ID/$OtherID' => 'handleMyRequest'

I have a form 'myCustomForm' with the action 'doFormAction'

I'm probably not understanding how routing works, I know that the form is somehow assigned as the $Action on submit, because after submitting the site is redirected to:


and the form action is not processed. So in 'handleMyRequest' I tried to call 'doFormAction' but that doesn't seem to do anything with the form data. I hope I am explaining this well, any ideas?

Thank you


30 August 2014 at 10:16am Community Member, 145 Posts

Man this is a stumper! Someone must have done this? A form on a page with url_handlers? What's the trick? Been at it all day!!!


30 August 2014 at 10:49pm Forum Moderator, 5511 Posts

In this case you don't need to muck with the $url_handlers. You're correct the form action will go directly back to the Form action (so you must have 'myCustomForm' as an allowed action and not rely on anything else to return the form object). The actual form action is called by Form::httpSubmission() based on what is in the REQUEST data.

If you paste your whole code example I might be able to help a little bit more.


3 September 2014 at 1:42pm Community Member, 145 Posts

Hi Will,

Thank you for your advice, I was able to get this to work. I did wind up re-writing my handlers as such:

private static $url_handlers = array(
'category/$ID' => 'byCategory',
'tag/$ID' => 'byTag'

And I think I was missing 'myCustomForm' as an allowed action, but it is all good now. I really appreciate your response!