21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 871 Views |
-
question about create form url

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="www.domain.com/Page_Controller/SearchForm?keywords=xxxx">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.
-
Re: question about create form url

17 October 2009 at 12:38am
hi,
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.
| 871 Views | ||
|
Page:
1
|
Go to Top |


