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
-
I added a custom table view.
-
Looks impressively good. Thanks for sharing Sean!
-
Steven, You're welcome. I'm glad you liked it and thanks for commenting!
-
Thanks Sean! Very helpful for a project I'm working on! Really appreciate your sharing :-)
-
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?
-
An RTF Text field also accepts html code.... Just mentioning...
-
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
-
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
-
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...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>")
-
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?
-
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.
-
The + Text + is a Text field inserted into the HTML
-
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
-
Thanks Sean :-))))) for the JavaScript/HTML info! Definitely have to play around with it! Karen
-
@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.I labled the Multiline text field "Rich Text Raw", but I didn't use the
raw()
function since it isn't necessary. -
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!
-
thanks all, it's awesome to generate content
-
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
-
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
- 1 yr agoLast active
- 31Replies
- 5887Views
-
6
Following