Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-12-16 10:21:49
- koobs
- Member
- Registered: 2008-11-25
- Posts: 27
txp:search_input form troubles
Hi all,
Apologies if I’ve missed something obvious here… I have a search field in the sidebar that appears on all pages. When using the default <txp:search_input /> everything worked fine but I wanted a little more control over the html so I tried to add a txp form.
Now it doesn’t seem to acknowledge section=“search” as the destination page, always reverting to the home/default page. So my url looks like http://example.com/?q=searchterm instead of http://example.com/search/?q=searchterm after I initiate a search.
Here is the code in my page
<txp:search_input form="search_input" section="search" />
and the form:
<form action="<txp:site_url />">
<input type="text" name="q" value="Search..." />
<input type="submit" class="button orange" value="Search" />
</form>
Anyone have any idea why section=“search” doesn’t seem to be recognised.
thanks
Offline
#2 2009-12-16 11:05:21
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: txp:search_input form troubles
Hi,
usually I output the search form directly with an “output_form” tag.
Anyway you can try (not tested) omitting the section="search"
from the “search_input” tag and replacing in your form
<form action="<txp:site_url />">
with:
<form action='<txp:site_url /><txp:section name="search" />'>
Offline
#3 2009-12-16 11:19:09
- koobs
- Member
- Registered: 2008-11-25
- Posts: 27
Re: txp:search_input form troubles
redbot wrote:
Hi,
usually I output the search form directly with an “output_form” tag.
Thanks – didn’t think of that – makes more sense
Anyway you can try (not tested) omitting the
section="search"
from the “search_input” tag and replacing in your form
FYI this also works
Thanks very much
Offline
Re: txp:search_input form troubles
You could improve on that with:-
<input type="text" name="q" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}" />
Plus you could give both inputs an id to improve selectivity in the CSS. Just a couple of suggestions.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Pages: 1