Basic JavaScripting - Adding a color picker

If you've been learning and using FileMaker for any amount of time, then you'll likely know that FileMaker also has access to JavaScript. It does this through the Web Viewer object which can easily be added to any layout.

For some FileMaker developer's they may answer the question of "Why don't you know/learn Javascript?" with a response of it either being too hard or not being able to take the time to learn it. It' only when FileMaker can't do what what needs to be done when some developers start to look outside of FileMaker's core set of available tools.

The cool thing about JavaScript is that like many tools, it can do a variety of things better than FileMaker alone. I've never come across a single tool which can do it all the best way possible.

If you've never implemented any JavaScript within your FileMaker solution, then this video may be the best way to start that journey. The implementation of a JavaScript based color picker is so easy you'll be craving more and more JavaScript by the end of the video. Whether you need a color picker or the ability to draw content on top of an image file, JavaScript will offer a lot more extensibility than just sticking it out with FileMaker alone!

AttachmentSize
BasicJavascripting.zip505.08 KB

Comments

There is an issue with the web site that videos will occasionally become not available when the server side cache is not updated. I'm trying to work on a fix for that.

Just a little note.
You say (@33:38) that the FileMaker rgb function works as well with commas as with semicolons.
But apparently not in our part of the world (Belgium, Dutch speaking part).
Substituting the commas (as in "TextColor ( Javascript::name ; Evaluate ( Substitute ( Get ( ScriptParameter ); ","; ";" ) ) )" does the trick.

Luc

Thanks, Matt.
Excellent as always.

I had the same issue with commas as Luc here in Norway, but I chose to make the substitution in the Javascript itself.
window.location = 'fmp://$/Basic%20Javascripting?script=Runme&param=' + encodeURI(color.toRgbString().replace(/\,/g,";"));

Yes, you can always run the substitution in either JavaScript or within FileMaker. Thanks for posting the solution for other!