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.

17replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Sean
    • Sean
    • 3 yrs ago
    • Reported - view

    I added a custom table view.

    Like
  • Looks impressively good. Thanks for sharing Sean!

    Like
    • Sean
    • Sean
    • 3 yrs ago
    • Reported - view

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

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

    Like
    • Sean
    • Sean
    • 3 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? 🤔

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

    Like
    • havrup
    • havrup
    • 2 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

    Like
    • Sean
    • Sean
    • 2 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

    Like
    • Sean
    • Sean
    • 2 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>")

    Like
  • 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?

    Like
    • Sean
    • Sean
    • 2 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.

    Like
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

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

    Like
    • havrup
    • havrup
    • 2 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

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

    Like
    • Sean
    • Sean
    • 2 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.

    Like
  • 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!

    Like
    • Admin
    • Admin.7
    • 4 mths ago
    • Reported - view

    thanks all, it's awesome to generate content 

     

    Like
Like2 Follow
  • 2 Likes
  • 4 mths agoLast active
  • 17Replies
  • 4759Views
  • 2 Following