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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

question about create form url

Go to End

2 Posts   1211 Views


Community Member, 2 Posts

16 October 2009 at 3:43pm

I have a search form object, and I need to build some links that post to that form. eg:

I need a link like:
<a href="">xxxx</a>

I don't want to hardcode in case the form's name or other things changed. is there any other way to create a link?
like: searchForm.Link("xxxx") will build a link. In orther to write such a funcion, what do I need?

I am quite new to silverstripe, thanks for help. please give me some clues.


Community Member, 400 Posts

17 October 2009 at 12:38am


a good question. I will just tell you with I will do. There can be a separate page type for the form; which you can define. On a very basic level (top of the hierarchy / Page.php) you can have a method to get the URL of the form pages controller. I think it is unlikely to change the form name; so you can hard code it. As the controller can change you might get it from the DataObjects.

Or else you can get the form. and the form object itself has methods to retrieve the form name.

refer to the Form documentation from the API.