22403 Posts in 6882 Topics by 2748 members
|Go to End|
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:
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.
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.
|Go to Top|