Prototype WebDialog replacement for Ruby InputBox

I’ve been working on a Ruby Tool, with much help from @slbaumgartner and others on this forum on different aspects of it. My original post seeking help was here

I wanted a replacement for the ruby InputBox which would validate the inputs before they get used.

I’ve got as far as a prototype which:

  • can use the following types of input field: select, numeric, integer, length (in imperial or metric units), or filename
  • validates input for type (except select, where the list values must be validly specified by the programmer)
  • validates for range - optional min and/or max values (for numeric and integer only, at least at the moment, though I wrote for other purposes a couple of years ago a converter from imperial (feet, inches and fractional lengths) to decimal inches, so could use that for length min and max values (with small extension to metric to allow for SU’s mm, cm and m suffices)
  • informs the user of the valid type and range (if specified) for each field
  • won’t submit data until all fields are valid
  • can be easily customised to use more or fewer fields, in any combination of supported field types

I wrote it after trying to find any examples of WebDialogs that went beyond the very basic examples such as the excellent ‘starter’ by Martin Rinehart, but weren’t so complex as to be incomprehensible. And I couldn’t quite get my head round ThomThom’s object oriented and JQuery based plugin, which is much more versatile than what I needed.

I attach here an installable RBZ plugin to try out, and to get feedback as to whether it would be a useful starting point for others.

JWM_wd_InputBox.rbz (9.0 KB)

After installation, it opens a sample web dialogue with one error in the second field, which prevents it sending data until corrected.

It is supposed to be an extension, but I see it doesn’t appear (at least not immediately) in the Extensions list in Preferences/Extensions.
[Edit] It does appear after restarting SU, so you can disable it when you finish testing, or even go to Plugins and delete the file and folder.

So far, tested only in SU 2016 on Mac.

Please let me know what you think of it, and how it could be improved - both in function, and in being able to be adapted if needed for older (and potential newer) versions of SU, and for different operating systems and languages, if it is found to be of any value in English.