2

html() function

I uploaded a database named HTML Tricks. So far it only has one example, but I've got some other ideas I've been playing with. If you are interested in a blinking formula field you should give this a look.

31 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    I added a custom table view.

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    Looks impressively good. Thanks for sharing Sean!

    • Sean
    • 4 yrs ago
    • Reported - view

    Steven, You're welcome. I'm glad you liked it and thanks for commenting!

    • Karen_Estrada
    • 4 yrs ago
    • Reported - view

    Thanks Sean! Very helpful for a project I'm working on! Really appreciate your sharing :-)

    • Sean
    • 4 yrs ago
    • Reported - view

    Karen, You bet! I didn't figure out until just recently that the html() function practically turns the formula field into a browser window. This is the description in the language reference...

     

    html(text) - Returns a rich text representation of a text.

     

    Maybe a little understated? 🤔

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    An RTF Text field also accepts html code.... Just mentioning...

    • havrup
    • 3 yrs ago
    • Reported - view

    Sean,

    hope you can answer my question - I'm not an HTML expert but played around a little bit with it. 

    I looked in the db hoping to find my answer but found a lot of other interesting things!

    I have a need to dynamicly create a Button (one after each line) and when I press it, it will open an URL (with openURL() or in a not so good case an "url string" (ex www.google.com).

    I can't find a way that NINOX let me dynamicly add Button but I can create them inside a html() function and they will be displayed in the formulafiled (richtext field).

    BUT.... and this is my question - how to add an action to the Bottun? I can click it but nothing happen even though I have used what I believe is the right HTML tags.

    One of all the versions I tried is this:

    html("<button onclick=https://www.google.com> Open google</button>")

    Regards

    /Niclas

    • Sean
    • 3 yrs ago
    • Reported - view

    Hi Niclas,

    It might be easier to use the Ninox buttons and hide/show them as you like. I won't be to look into what you suggest until later.

    Sean

    • Sean
    • 3 yrs ago
    • Reported - view

    Niclas,

    I'd like to point out that I'm not an HTML expert either. I did find out something interesting, and yet, unsurprising... new functionality in Ninox that is not documented, i.e. Javascript in the html() function. This thread says, no, you can't use Javascript...

     

    https://ninox.com/en/forum/technical-help-5ab8fe445fe2b42b7dd39ee7/html-function-5bdc3ee07218b263ad4b3335?post=5c8cfb741a169a5a5d6e03c1&page=1

     

    It seems you can now. This is an example of how you can open a link with a button. It will launch the default browser.

     

    html("<button onclick=""window.location.href='https://google.com';"">Click Here</button>")

     

    Here is an example of hiding and showing...

     

    html("<button id=""button1"" onclick=""hideButton3()"">Button 1</button>
    <button id=""button2"" onclick=""showButton3()"">Button 2</button>
    <button id=""button3"">Button 3</button>
    <script>
    function hideButton3() {
    document.getElementById(""button3"").style.visibility = ""hidden"";
    }
    function showButton3() {
    document.getElementById(""button3"").style.visibility = ""visible"";
    }
    </script>")

    • Choices_Software_Dean
    • 3 yrs ago
    • Reported - view

    Sean,

    Your HTML Tricks database is very nice. Thank you for sharing.

     

    Can html be used to change the font color within a Ninox rich text field? If so, what would the code look like?

    • Sean
    • 3 yrs ago
    • Reported - view

    Hi Dean,

    It can, but you have to do it all at once. Meaning, you can't modify just part of the Rich text like...

     

    'Rich text' := 'Rich text' + html("formatted text")

     

    Formatting is most commonly added to <p> and <div> tags in HTML. Here is an example...

     

    'Rich text' := html("<div style=""color:blue;"">" + Text + "</div>")

     

    That is some code you would put in a button, but it's not very useful. You would need to design the complete text, and any fields you wanted to include, and assign it to the Rich text field.

    • Sean
    • 3 yrs ago
    • Reported - view

    The + Text + is a Text field inserted into the HTML

    • havrup
    • 3 yrs ago
    • Reported - view

    Tanks Sean!

    Works just the way I wanted. I changed http to file and then open a PDF file on my mac.

    I will dynamicly print "rows" in a function field (so I never now how many), and every row point to one or two PDF files. Now I can put  Buttons beside the row and the user can open the assosiated PDFs.

    Hope one day Ninox announce and document the features you can use!

    /Niclas

    • Karen_Estrada
    • 3 yrs ago
    • Reported - view

    Thanks Sean :-))))) for the JavaScript/HTML info! Definitely have to play around with it! Karen 

    • Sean
    • 3 yrs ago
    • Reported - view

    @Dean and anyone else who is interested. It looks like the html() function isn't required to markup the Rich text field. I just copied the contents of the Rich text field to a Multiline textfield using a button and it transfers the markup along with the text. For the oldsters who used the pre-WYSIWYG word processors this should be old hat.

     

    Screen Shot 2020-08-06 at 10.03.52 PM

     

    I labled the Multiline text field "Rich Text Raw", but I didn't use the raw() function since it isn't necessary.

    • Rafael_Braz
    • 3 yrs ago
    • Reported - view

    Hello!!

    is there any way we can print report with HTML links in Ninox?

    I was able to make the links work in the print window, but after it is converted to pdf they stop working

    tks!

    • Admin.7
    • 2 yrs ago
    • Reported - view

    thanks all, it's awesome to generate content 

     

    • francescostefanello
    • 10 mths ago
    • Reported - view

    Sean your formula can really help me and thank for this. I wolud like to make some modifies:

    for example: this is a javascript

     

    html("<button id=""button1"" onclick=""calcolaMinimo()"">Button 1</button>
    <script>
    function calcolaMinimo() {
    const arr = [14, 58, 20, 77, 66, 82, 42, 67, 42, 4]
    const min = Math.min(...arr)
    console.log(min);
    }
    </script>")

     

    the javascript is not important, what is important to me is how can assign the value (min) to a a field in the same record (or in another record)

     

    Thank you in advance

      • Sean
      • 10 mths ago
      • Reported - view

       

      If you are using the browser version of Ninox you should be able to use the API. I believe it is possible to do it in the Mac version as well, but both methods are more  forte.

      • francescostefanello
      • 10 mths ago
      • Reported - view

      so i wait for Jacques come back from vacation. In the meanwhile i thank you Sean for quick response

      • Ninox developper
      • Jacques_TUR
      • 10 mths ago
      • Reported - view

      francesco.stefanello  
      The easiest way would be to use NativeJS, which requires Ninext to be installed. Do you want to do that?

      • francescostefanello
      • 10 mths ago
      • Reported - view

      sure

      • Sean
      • 10 mths ago
      • Reported - view

       

      You can do it with Ninox script easily. The Ninox min() function will return the smallest value in an array. I put the following in a Formula field.

      let ary := [14, 58, 20, 77, 66, 82, 42, 67, 42, 4];
      min(ary)
      

      You can use a Ninox Button element to assign the value of the Formula field to any field in your database.

      YourFieldName := MinFormulaFieldName
      • francescostefanello
      • 10 mths ago
      • Reported - view

      thank you, the script was only an example, i have scripts that scrape HTML sites and return data. i would like to handle the all thing from Ninox, without opening other platforms editors etc

    • francescostefanello
    • 10 mths ago
    • Reported - view

    this script assigned to a formula change the value of it when a button is pressed, and works regularly

     

    html("<button id=""button1"" onclick=""calcolaMinimo()"">Button 1</button>
    <field id=""field"">field2</button>
    <script>
    function calcolaMinimo() {
    const arr = [14, 58, 20, 77, 66, 82, 42, 67, 42, 4]
    const min = Math.min(...arr)
    console.log(min);
    document.getElementById(""field"").textContent = min;
    }
    </script>")

Content aside

  • 2 Likes
  • 10 mths agoLast active
  • 31Replies
  • 5737Views
  • 6 Following