www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  Scripting    Replacing Boolean words with symbols in Webpublisher
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
I have used the sample script from the Script Library to replace Boolean words in a DB/Textworks query screen with Boolean symbols.

This works fine in DBText, but when you export the query screen to html the script doesn't work in Webpublisher. How can you achieve the same effect in a Webpublisher query screen?
 
Posts: 12 | Registered: Sun December 21 2003Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Hi mquill,

I use a script that does just that - that way Google users can still search our DB/TextWorks textbases!

You will need to manually add these two JavaScript functions to your search screen, and add a call to your submit button, as shown below:

Here's the script:

<script type="text/javascript">
function ConvertOperator(searchstr){
searchstr = searchstr.replace(/ AND /g, " & " ) ;
searchstr = searchstr.replace(/ And /g, " & " ) ;
searchstr = searchstr.replace(/ and /g, " & " ) ;
searchstr = searchstr.replace(/ OR /g, " / " ) ;
searchstr = searchstr.replace(/ Or /g, " / " ) ;
searchstr = searchstr.replace(/ or /g, " / " ) ;
searchstr = searchstr.replace(/ NOT /g, " ! " ) ;
searchstr = searchstr.replace(/ Not /g, " ! " ) ;
searchstr = searchstr.replace(/ not /g, " ! " ) ;
return searchstr;
}

function CheckSymbols(){
var qBoxes = document.body.getElementsByTagName("INPUT");
for(x=0; x< qBoxes.length; x++) {
if (qBoxes[x].getAttribute("type")=="text" ) {
qBoxes[x].value=ConvertOperator(qBoxes[x].value);
}
}
}
</script>

and here's the button:

<input type="submit" onClick="JavaScript:CheckSymbols()" value="Search">
 
Posts: 87 | Location: Melbourne, Victoria, Australia | Registered: Fri May 11 2001Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Dear EasyE
Thanks very much for your help with this script.
Regards
Margaret



quote:
Originally posted by EasyE:
Hi mquill,

I use a script that does just that - that way Google users can still search our DB/TextWorks textbases!

You will need to manually add these two JavaScript functions to your search screen, and add a call to your submit button, as shown below:

Here's the script:

<script type="text/javascript">
function ConvertOperator(searchstr){
searchstr = searchstr.replace(/ AND /g, " & " ) ;
searchstr = searchstr.replace(/ And /g, " & " ) ;
searchstr = searchstr.replace(/ and /g, " & " ) ;
searchstr = searchstr.replace(/ OR /g, " / " ) ;
searchstr = searchstr.replace(/ Or /g, " / " ) ;
searchstr = searchstr.replace(/ or /g, " / " ) ;
searchstr = searchstr.replace(/ NOT /g, " ! " ) ;
searchstr = searchstr.replace(/ Not /g, " ! " ) ;
searchstr = searchstr.replace(/ not /g, " ! " ) ;
return searchstr;
}

function CheckSymbols(){
var qBoxes = document.body.getElementsByTagName("INPUT");
for(x=0; x< qBoxes.length; x++) {
if (qBoxes[x].getAttribute("type")=="text" ) {
qBoxes[x].value=ConvertOperator(qBoxes[x].value);
}
}
}
</script>

and here's the button:

<input type="submit" onClick="JavaScript:CheckSymbols()" value="Search">
 
Posts: 12 | Registered: Sun December 21 2003Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  Scripting    Replacing Boolean words with symbols in Webpublisher