Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListXSL SearchXSL Search
Previous
 
Next
New Post
9/7/2010 1:30 PM
 
Hi,
    I'm trying to create a search engine for 2 fields of type string (Legenda, Cidade). This search will include 2 inputs and one submit button. 
    
Code:
 
<xsl:key name="dataLegenda" match="udt:Data" use="udt:Legenda" />
   <xsl:key name="dataCidade" match="udt:Data" use="udt:Cidade" />
....
 <xsl:variable name="prefix_param">udt_<xsl:value-of select="//udt:Context/udt:ModuleId" />_param</xsl:variable>
  <xsl:param name="param_search" />
  <xsl:param name="param_searchpostback" />
  <xsl:param name="param_search1" />
  <xsl:param name="param_searchpostback1" />
  <xsl:param name="param_ispostback" />
  <xsl:variable name="search">
    <xsl:choose>
      <xsl:when test="$param_ispostback">
        <xsl:value-of select="$param_searchpostback" />
<xsl:value-of select="$param_searchpostback1" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$param_search" />
<xsl:value-of select="$param_search1" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
<xsl:template match="/udt:UserDefinedTable">
    <xsl:variable name="searchColumns" select="//udt:Fields[udt:Searchable='true']/udt:ValueColumn" />
    <xsl:if test="//udt:Fields[udt:Searchable='true']">
      <xsl:call-template name="SearchForm" />
    </xsl:if>
    <xsl:variable name="currentData" select="udt:Data[contains(*[name()=$searchColumns][1],$search) or contains(*[name()=$searchColumns][2],$search) or contains(*[name()=$searchColumns][3],$search) or contains(*[name()=$searchColumns][4],$search) or contains(*[name()=$searchColumns][5],$search)]" />
    <xsl:if test="$currentData">
      <table>
        <xsl:apply-templates select="$currentData" mode="list">
        </xsl:apply-templates>
      </table>
    </xsl:if>
  </xsl:template>


  <xsl:template name="SearchForm">
    <input type="text" name="{$prefix_param}_searchPostback" value="{udt:Data[key('dataLegenda', udt:Legenda)[0]]}" />
<input type="text" name="{$prefix_param}_searchPostback1" value="{udt:Data[key('dataCidade', udt:Cidade)[0]]}" />
    <input type="submit" name="go" value="{//udt:Context/udt:LocalizedString_Search}" />
    <input type="hidden" name="{$prefix_param}_ispostback" value="true" />
  </xsl:template>

    
  I'm only able to search in one input. Need some help to fix this...

Thks,
NS
 
New Post
9/8/2010 2:34 PM
 
NS, your script can't work that way. You combine both search inputs to a single string, then you compare whether this string is included in a field.
 
New Post
9/8/2010 2:37 PM
 
One step forward to your solution:

Instead of
<xsl:variable name="currentData" select="udt:Data[contains(*[name()=$searchColumns][1],$search) or contains(*[name()=$searchColumns][2],$search) or contains(*[name()=$searchColumns][3],$search) or contains(*[name()=$searchColumns][4],$search) or contains(*[name()=$searchColumns][5],$search)]" />
use
<xsl:variable name="currentData" select="udt:Data[contains(udt:Legenda, $param_searchpostback) or contains(udt:Cidade,$param_searchpostback1)" />


 
New Post
9/9/2010 7:04 AM
 
Hi Stefan,
   Thank you very much...
   Other question: the filter is case-sensitive, exist another way to make de filter not sensitive than the way explained here.
 
New Post
9/9/2010 10:18 AM
 
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListXSL SearchXSL Search


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out