<div dir="ltr"><div>This compiles and runs more-or-less correctly now - using code which has been vastly simplified compared to the previous code (in the previous message).<br></div><div><br></div><div>The working code for the present example is in this GitHub repo:</div><div><br></div><div><a href="https://github.com/StefanScott/urweb-queryX1-dyn-ctextbox-onkeyup">https://github.com/StefanScott/urweb-queryX1-dyn-ctextbox-onkeyup</a></div><div><br></div><div>This message is also copied as the README on that repo.</div><div><br></div><div>Note: Currently, you have to add the records to the table using psql, etc. (ie, there is no web interface to add records yet).</div><div><br></div><div>Actually there is also a script called `insert.sql` which will add the 50 US states for you.</div><div><br></div><div>The file `script.txt` contains all the Linux commands to:</div><div><br></div><div>- get this compiled, </div><div>- (optionally drop and) create the database, and</div><div>- (optionally) insert the 50 US states</div><div><br></div><div>using Postgres as the database.</div><div><br></div><div>---</div><div><br></div><div>There are a few caveats:</div><div><br></div><div>(1) This is basically my first attempt at FRP, so I have no idea if this is best / proper way to wire the source and signal together.</div><div><br></div><div>(2) Ideally, the page should be able to display *all* the records when it initially loads.</div><div><br></div><div>I tried to do this by copying the code from `<ctextbox onkeyup={...}` to `<body onload={...}>` - but I got error messages.</div><div><br></div><div>(2) Since a signal is *automatically* updated when its source changes (without the need to write any `on_` event code), it feels kinda kludgy to be using the `onclick` event of the the `<ctextbox>`.</div><div><br></div><div>So I wonder if there is a way to update the recordset simply in response to the user typing in the `<ctextbox>` - without using an `on_` event anywhere.</div><div><br></div><div>This has been done for another example - but that example used only client-side data:</div><div><br></div><div><a href="https://github.com/StefanScott/urweb-ctextbox-echo">https://github.com/StefanScott/urweb-ctextbox-echo</a></div><div><br></div><div>So I'm not sure if the present example, which involves reading data from the server-side (ie, running `queryX1`), can be done without using an `on_` event - because of the questions below:</div><div><br></div><div>Question (1)</div><div><br></div><div>For an example like this, which does a transactional "read" (but no transacational "write") on the server (ie: it uses `queryX1`), is it *obligatory* to have a "blocking" call to `rpc` somewhere in the code?</div><div><br></div><div>Question (2)</div><div><br></div><div>If the answer to (1) is "YES", then does this further imply that a control *must* be used which has an `on_` event (eg, currently the `onkeyup` event of the `<ctextbox>` control) - simply because it's necessary to have an `on_` event somewhere, in which make the call to `rpc`? </div><div><br></div><div>I suspect the answer  to (2) *may* "NO" here - eg, maybe the call to `rpc` could be done from inside a `<dyn>` tag, which would obviate the need for an `on_` event.</div><div><br></div><div>I've been trying this, but so far have not gotten it to work - I keep getting type errors. (I think the result type of an `on_` event is `transaction unit` - whereas the result type of the code in the `signal` attribute of a `<dyn>` is `signal xml` - so this may be causing the type errors). </div><div><br></div><div>---</div><div><br></div><div>Minor quibble:</div><div><br></div><div>The `LIKE` operator in Postgres is case-sensitive. There is also a non-case-sensitive version `ILIKE`, but it does not appear to have been implemented yet in Ur/Web. </div><div><br></div><div>Of course, a case-insensitive pattern-match could be done using a work-around: eg, before searching, simply convert the search string to all lower-case (resp. all upper-case), and then while doing the search, also convert the column being searched to all lower-case (resp. all upper-case). </div><div><br></div><div>I imagine that it might not be too difficult for a programmer to add support for Postgres `ILIKE` (plus whatever the corresponding operator is in MySQL) to the Ur/Web compiler.</div><div><br></div><div>---</div><div><br></div><div>Thanks for any feedback. It feels really cool to see Ur/Web using FRP to instantly filter records like this!</div><div><br></div><div>###</div><div><br></div></div>