Inmagic Forums
Inmagic Forums
Scripting
Replacing Boolean words with symbols in Webpublisher|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
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? |
|||
|
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"> |
||||
|
Dear EasyE
Thanks very much for your help with this script. Regards Margaret
|
||||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|
Inmagic Forums
Inmagic Forums
Scripting
Replacing Boolean words with symbols in Webpublisher
