[Ur] Help needed to implement a data-bound type-ahead / auto-complete widget for Ur/Web, to support easy editing of foreign-key fields

Stefan Scott Alexander stefanscottalexx at gmail.com
Sat Jul 11 13:30:18 EDT 2015


Ur/Web's home page states that it "supports construction of dynamic web
applications backed by SQL databases".

However, more than 5 years after its release, Ur/Web still lacks one of the
most essential components for developing database applications: a
data-bound type-ahead
/ auto-complete widget supporting easy editing of foreign-key fields.

In the interest of raising awareness and encouraging collaboration on this
issue, I've put up a github repo of a small Ur/Web database project I'm
working on. As the ReadMe points out, this project is (and will
unfortunately forever remain) largely unusable until someone figures out
how to add a data-bound type-ahead / auto-complete widget to allow users to
conveniently edit the foreign-key fields.

https://github.com/StefanScott/urweb-crudcrud/

But this isn't just a problem for this particular Ur/Web database app -
this is a problem for *all* Ur/Web database apps - because, as we know,
most databases use an auto-increment integer "surrogate" primary key column
(eg: customer.id), while the user thinks and works in terms of another
(generally also unique) "human-readable" column or set of columns (eg:
customer.name, or customer.first_name + customer.last_name).

Probably no modern real-world database app in existence would expect the
user to select a parent record by (memorizing and) manually typing an
integer foreign key into a plain text field (eg: invoice.customer_id) -
this would be totally crazy! But unfortunately, this is how all published
Ur/Web database examples do it. How can such a powerful web database
framework be lacking such an essential UI widget - over five years after
release?

Of course, the right way to let the user select a foreign key is the way
nearly all other modern database apps do it: via some sort of menu or "pick
list" - nowadays often implemented in the browser as a "type-ahead" or
"auto-complete" input field.

Without a data-bound type-ahead / auto-complete widget for editing
foreign-key fields, it is unlikely that Ur/Web will ever see much
adoption among
database application developers. As back-end developers, they would of
course be perfectly capable of *using* a data-bound type-ahead /
auto-complete widget for their foreign-key fields - most of them (including
me :-) probably would not have the front-end development skills needed to
*create* this kind of widget on their own for Ur/Web.

So I'm wondering if there might be anyone out there who might be willing
and able to create a data-bound type-ahead / auto-complete widget for
Ur/Web? This would be a great contribution to help make Ur/Web usable by
other database application developers out there!

At the link below are three Issues I've also posted on the github repo,
showing:
(a) some results and discussions on my initial (so far unsuccessful)
attempts to use Ur/Web FFI to wrap an existing JavaScript library such as
Select2 or Twitter typeahead.js; and
(b) some questions regarding whether / how this could be done "natively" in
Ur/Web.
https://github.com/StefanScott/urweb-crudcrud/issues
(See the first three issues posted)

Thanks for any ideas or help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150711/ca8657b8/attachment.html>


More information about the Ur mailing list