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.

Template Questions

Page control/function for getting current directory?


Reply

2 Posts   1580 Views

Avatar
Samba Sam

24 November 2009 at 3:00pm (Last edited: 24 November 2009 3:00pm), Community Member, 85 Posts

Hi,
I am customizing the $SearchForm.ss for my template. I need to get the current directory for calling up the action for the search form.

As in...
<form id="SearchForm_SearchForm" action="/currentdirectory/SearchForm" method="get" enctype="application/x-www-form-urlencoded">

Is there a page control for getting the current directory/page. If not, what would be the alternative (e.g., page controller function)?

Thanks,
Sam

Avatar
Samba Sam

25 November 2009 at 11:20am (Last edited: 25 November 2009 11:21am), Community Member, 85 Posts

Hi,
I should have looked at the sapphire SearchForm.ss template before posting.

I got the search form working by using $FormAttibutes. The sapphire SearchForm template has some extra tags that I don't need (e.g., fieldset and legend).

So, I created a file SearchForm.ss with the following in the root of my template folder, which includes a bit of javascript to remove the "search" text when the search box is clicked on.

<form $FormAttributes >
<input type="text" name="Search" id="search" value="Search.." onfocus="if(this.value == 'Search..') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search..';}"/>
<input class="action" id="SearchForm_SearchForm_action_results" type="submit" name="action_results" value="GO" title="GO" />
</form>

And used $SearchForm in my page.ss template to call it up.

Sam