Scripting

<< Click to Display Table of Contents >>

Navigation:  Web Gateway > System >

Scripting

 

Questions and answers about OMNITRACKER ↦ System ↦ Scripting:

 

Search Field Title: How to add an asterisk automatically in front of the search string?

An OnOpenScript must be completed with the following code in the web search form:

Set fold = ActiveFolder
Set filt = fold.MakeFilter
filt.UserField("Title") = "∗"
filt.AllowWildcards("Title") = True
ActiveSearchFilter = filt

As a result, an asterisk is automatically added to the beginning of the search string for the field "Title".

 

WEB Form – Text items with HTML-Tags: Why does my client-side JavaScript does not work more?

Due to the fact that there is no longer a GET-call when opening the object form, the inclusion of <script> blocks is no longer possible since OMNITRACKER Version 10.7.0. The opening now happens within a POST-call on the Main.aspx page. The Main.aspx page is partially updated and (in contrast to earlier versions < V10.7.0) no redirect to a separate object form page is performed anymore. If javascript code blocks (<script> ... javascript code ... </script>) are included in an object form, they are no longer interpreted by the browser (due to the partial update on the page). Alternatively, a "Specific Javascript" can be created in the web configuration. Further information can be found in the "10.7 Update Guide".

You will find more uncomplicated solutions below:

  • Example 1: You use a text item (flag "HTML tags in texts" is set) in a Web form with ff. HTML code for a clickable button:

    <button onclick="myFunction()">Try it</button>

    <script>
    function myFunction() {
    alert("Hello! I am an alert box!");
    }

    </script>

    The <script> block is ignored in V10.7.0. You have to put the complete function (myFunction) into the onclick attribute.

    => <button onclick="alert('Hello! I am an alert box!')">Try it</button>

    Please pay attention to the quotation marks: If the on click event is enclosed in double quotation marks (") then only single (') may be used in the script.

  • Example 2: You use a text item (flag "HTML tags in texts" is set) in a Web form with ff. <script> block

    <script>
    alert ("Hello world!");
    </script>

    The <script> block is ignored as of V10.7.0, because there is no GET-call anymore when opening the project form. As a workaround, you can use the onload event of an image, i.e. include an invisible image and execute the Javascript in the onload.

<img alt="" src="images/Transparent.png" onload="alert('Hello Other World!');">

Please pay attention to the quotation marks: If the onload event is enclosed in double quotation marks (") then only single (') may be used in the script.