Is it possible to have more than one AnyText Field within a custom search in Weblink Designer? Everytime when I try to add an additional AnyText or DocumentText field, I am prompted with a notification of:
Is it possible to have more than one AnyText Field within a custom search in Weblink Designer? Everytime when I try to add an additional AnyText or DocumentText field, I am prompted with a notification of:
It is but you will need to do it manually by modifying the associated custom search XML file that is created when you compile and save it.
To demonstrate create a new custom search form in Designer and place only a AnyText field and Submit button. Compile and save it as WLTST.
Close out Designer and navigate to the Laserfiche WebLink program directory (ie. C:\Program Files\Laserfiche\WebLink\Web Files\searchforms\YOURREPOSITORYNAME). In this directory you will see a file name WLTST.xml.
Open up the WLTST.XML file and you should see the following:
<?xml version="1.0" encoding="utf-8"?> <Weblink.SearchForm xmlns:lf="http://schemas.laserfiche.com/Weblink/8/LfControls" xmlns:asp="http://schemas.laserfiche.com/Weblink/8/System.Web.UI.WebControls"> <SearchForm Name="Multiple Text Box" Description=""> <UI> <input runat="server" id="MultipleTextBox_Input0" resetval="" /> <lf:Submit runat="server" id="MultipleTextBox_Button1" Text="Submit" /> </UI> <Query> <And> <Constraint Type="Basic" Operator="eq" MatchAll="False" MatchWholeWord="True" UseWildcards="False" ControlID="MultipleTextBox_Input0" SearchName="AnyText" /> </And> </Query> <SortOptions /> <Summary> </Summary> <TokenMap> <Token Name="AnyText" ControlID="MultipleTextBox_Input0" /> </TokenMap> </SearchForm> </Weblink.SearchForm>
Basically you are going to make a copy of the "input" element and add another "Constraint" element for that newly copied "input" element.
<input runat="server" id="MultipleTextBox_Input0" resetval="" />
The important thing to remember is that your new input element needs to have a unique id:
<input runat="server" id="MultipleTextBox_Input1" resetval="" />
And your new constraint element must contain the new input element id:
<Constraint Type="Basic" Operator="eq" MatchAll="False" MatchWholeWord="True" UseWildcards="False" ControlID="MultipleTextBox_Input1" SearchName="AnyText" />
One thing I did change was the "<And>" element to "<Or>" since I wanted my search to find either values in the text boxes.
<Or> <Constraint Type="Basic" Operator="eq" MatchAll="False" MatchWholeWord="True" UseWildcards="False" ControlID="MultipleTextBox_Input0" SearchName="AnyText" /> <Constraint Type="Basic" Operator="eq" MatchAll="False" MatchWholeWord="True" UseWildcards="False" ControlID="MultipleTextBox_Input1" SearchName="AnyText" /> </Or>
Below is the modified WLTST code:
<?xml version="1.0" encoding="utf-8"?> <Weblink.SearchForm xmlns:lf="http://schemas.laserfiche.com/Weblink/8/LfControls" xmlns:asp="http://schemas.laserfiche.com/Weblink/8/System.Web.UI.WebControls"> <SearchForm Name="Multiple Text Box" Description=""> <UI> <input runat="server" id="MultipleTextBox_Input0" resetval="" /> <input runat="server" id="MultipleTextbox_Input1" resetval=""/> <lf:Submit runat="server" id="MultipleTextBox_Button1" Text="Submit" /> </UI> <Query> <Or> <Constraint Type="Basic" Operator="eq" MatchAll="False" MatchWholeWord="True" UseWildcards="False" ControlID="MultipleTextBox_Input0" SearchName="AnyText" /> <Constraint Type="Basic" Operator="eq" MatchAll="False" MatchWholeWord="True" UseWildcards="False" ControlID="MultipleTextBox_Input1" SearchName="AnyText" /> </Or> </Query> <SortOptions /> <Summary> </Summary> <TokenMap> <Token Name="AnyText" ControlID="MultipleTextBox_Input0" /> </TokenMap> </SearchForm> </Weblink.SearchForm>
Save the file, close it, and then open up the search in WebLink. This was tested in WebLink 9 and worked as expected.
Hope this helps!