
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.
-
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
-
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>")
-
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.
-
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
-
@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.