I have just decided that I want to add a searchfield on top of the search results as an addition to the searchbox already present at the very top of my page.
The problem is that the <form></form> tags does not get rendered - only the contents in between. I really can't figure out why, since I have only been editing a few settings to match my design in the xsltsearch.xslt file.
All <input> elements gets rendered just fine.
I have other websites which renders a <formid="aspnetForm"action="/soege-resultater.aspx?"method="post"></form> just fine around the results generated from XSLTsearch.
This is how my modified code looks like:
<!-- display search box at the top of the page (the search box is always present even if no search was attempted) --> <xsl:if test="$searchBoxLocation='TOP' or $searchBoxLocation='BOTH'"> <div id="contact_form" class="form_field"> <input name="search" type="text" class="text round_6" size="44" > <xsl:attribute name="value"> <xsl:value-of select="$unescapedSearch"/> </xsl:attribute> </input> <xsl:text> </xsl:text> <input id="submit" class="fancy" type="submit" name="search" > <xsl:attribute name="value"> <xsl:value-of select="$dictionaryButton-Search"/> </xsl:attribute> </input> </div> </xsl:if>
Older versions of XSLTsearch automatically inserted form tags but that caused many problems for people who had already inserted form tags in their templates (you can't have nested form's in html) so in more recent versions I've made it explicit that you have to provide your own form tags around the search macro.
If you don't already have a form tag around the macro you can either use a standard html form or an asp.net form (a <form> tag that includes the runat="server" parameter).
I generally have a separate search template that looks something like this. Customize to your needs obviously.
Sorry, I was not aware of that :/ The form is now almost working properly!
I'm only having one issue. The search string shows in the input text field after submitting a search from another form. Whenever I wan't to do another search from the "new" form (created on the search-results page), the querystring that is sent looks like this "/soege-resultater.aspx?search=my-search-string&search=Search".
I found it being related to this piece of XSLT code:
When you submit the search form, XSLTsearch looks for the input field called 'search' to know what to search for. If you've got multiple fields called 'search' in the same form they will all get submitted and that will confuse XSLTsearch as you can imagine.
The solution is to have only one search field called 'search'. Or at least only have one such field that has a value.
It looks like you added the name="search" and class="fancy" attributes to the submit button and that's the problem. Just call the button something other than "search" or simply don't give it a name.
Here's the code from XSLTsearch 3.0.3 for reference:
XSLTsearch form not not showing on result pages
Hi.
I have just decided that I want to add a searchfield on top of the search results as an addition to the searchbox already present at the very top of my page.
The problem is that the <form></form> tags does not get rendered - only the contents in between. I really can't figure out why, since I have only been editing a few settings to match my design in the xsltsearch.xslt file.
All <input> elements gets rendered just fine.
I have other websites which renders a <form id="aspnetForm" action="/soege-resultater.aspx?" method="post"></form> just fine around the results generated from XSLTsearch.
This is how my modified code looks like:
Thanks in advance!
Hi, Stefan,
Older versions of XSLTsearch automatically inserted form tags but that caused many problems for people who had already inserted form tags in their templates (you can't have nested form's in html) so in more recent versions I've made it explicit that you have to provide your own form tags around the search macro.
If you don't already have a form tag around the macro you can either use a standard html form or an asp.net form (a <form> tag that includes the runat="server" parameter).
I generally have a separate search template that looks something like this. Customize to your needs obviously.
doug.
Well, that worked poorly... let's try that again...
That wasn't what I wanted for formatting either, but at least now you can read it.
cheers,
doug.
Sorry, I was not aware of that :/
The form is now almost working properly!
I'm only having one issue. The search string shows in the input text field after submitting a search from another form.
Whenever I wan't to do another search from the "new" form (created on the search-results page),
the querystring that is sent looks like this "/soege-resultater.aspx?search=my-search-string&search=Search".
I found it being related to this piece of XSLT code:
The button has the value of "Search", and for some reason that is automatically submitted to the search.
Any clues why?
Best regards,
Stefan.
No problem, Stefan!
When you submit the search form, XSLTsearch looks for the input field called 'search' to know what to search for. If you've got multiple fields called 'search' in the same form they will all get submitted and that will confuse XSLTsearch as you can imagine.
The solution is to have only one search field called 'search'. Or at least only have one such field that has a value.
It looks like you added the name="search" and class="fancy" attributes to the submit button and that's the problem. Just call the button something other than "search" or simply don't give it a name.
Here's the code from XSLTsearch 3.0.3 for reference:
cheers,
doug.
Thank you again :)
Everythink works perfectly now!
I really appreciate your work with XSLTsearch - it's really a must have package!
You're welcome, glad you're finding it helpful.
cheers,
doug.
is working on a reply...