<div dir="ltr">You seem to have the right idea: you can indeed implement your own library of "rpc forms". Try filling in this signature (that is, .urs file):<div><br></div><div><font face="monospace, monospace">con rpcForm : {Type} -> Type</font></div><div><br></div><div><font face="monospace, monospace">val create : fields ::: {Type} -> $fields -> transaction (rpcForm fields)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">val textbox : </font></div><div><span style="font-family:monospace,monospace"> others ::: {Type} -> nm :: Name -> [[nm] ~ others] =></span></div><div><span style="font-family:monospace,monospace"> rpcForm ([nm = string] ++ others) -> xbody</span></div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">val submit :</span></div><div><span style="font-family:monospace,monospace"> fields ::: {Type} -> result ::: Type -></span></div><div><span style="font-family:monospace,monospace"> rpcForm fields -> ($fields -> transaction result) -> transaction result</span></div><div><br></div><div>Here's an example usage:<br></div><div><br></div><div><font face="monospace, monospace">val handle : {Name : string, FavColor : string} -> transaction unit =</font></div><div><font face="monospace, monospace"> (* something with rpc... *)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">val formExample : transaction page =</font></div><div><font face="monospace, monospace"> fm <- create {Nm = "", FavColor = ""};</font></div><div><font face="monospace, monospace"> return <xml></font></div><div><font face="monospace, monospace"> Your name: {textbox [Nm] fm}<br/></font></div><span style="font-family:monospace,monospace"> Your favorite color: {textbox [FavColor] fm}<br/></span><div><font face="monospace, monospace"> <button onclick={fn _ => submit fm handle}>Submit</button><br></font><div><font face="monospace, monospace"> </xml></font></div><div><br></div><div>And here's a start to the implementation (that is, .ur file):</div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">con rpcForm fields =</span></div><div><span style="font-family:monospace,monospace"> $(map (fn t => {Source : source t, Default : t}) fields)</span><br></div><div><br></div><div>Once you have this working, you probably want to implement analogues of <font face="monospace, monospace">textbox</font> for other types. To be clear, I just came up with this off the top of my head, so you will probably have to change some things.</div></div><div><br></div><div>Good luck!</div><div>Ziv</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 11, 2018 at 7:24 PM, Aistis Raulinaitis <span dir="ltr"><<a href="mailto:sheganinans@gmail.com" target="_blank">sheganinans@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Well I'm hoping to be able find some kind of happy middle between spurious reloads and verbosity of form definition.<div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">I'm fine with implementing a few abstractions myself, I'm just not sure what the correct direction is.</span><br></div><div dir="auto"><br></div><div dir="auto">Your widget system based on ML modules and functors is very interesting I'm just wondering how it would be possible to achieve what I'm attempting to do with as little friction as possible.</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Feb 11, 2018 16:16, "Adam Chlipala" <<a href="mailto:adamc@csail.mit.edu" target="_blank">adamc@csail.mit.edu</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_116001825108378788m_-3001681451173823246moz-cite-prefix">Maybe just stop worrying about it, so
that you might find that problems don't arise in practice? >:)<br>
<br>
On 02/11/2018 07:13 PM, Aistis Raulinaitis wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">Any pointers to get me started on the right path
when it comes to a more effective usage of source based forms?</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Feb 11, 2018 16:09, "Adam Chlipala"
<<a href="mailto:adamc@csail.mit.edu" target="_blank">adamc@csail.mit.edu</a>> wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_116001825108378788m_-3001681451173823246m_-6018174663665810012moz-cite-prefix">I'm not
sure what to suggest. No, there is no existing feature
like what you suggest. I have found it quite pleasant
to work with sources and widgets connected to them.<br>
<br>
On 02/11/2018 05:03 PM, Aistis Raulinaitis wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">The way that a form will pack all of its
contents into a stuct is a clear advantage over the
source based route. It requires defining possibly many
sources and wiring them all into the right slots,
having to call "get" on each one of them in the
onclick handler and then wire all the gotten values
into the handler.</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</blockquote>
<br>
</div>
<br></div></div><span class="">______________________________<wbr>_________________<br>
Ur mailing list<br>
<a href="mailto:Ur@impredicative.com" target="_blank">Ur@impredicative.com</a><br>
<a href="http://www.impredicative.com/cgi-bin/mailman/listinfo/ur" rel="noreferrer" target="_blank">http://www.impredicative.com/c<wbr>gi-bin/mailman/listinfo/ur</a><br>
<br></span></blockquote></div></div>
<br>______________________________<wbr>_________________<br>
Ur mailing list<br>
<a href="mailto:Ur@impredicative.com">Ur@impredicative.com</a><br>
<a href="http://www.impredicative.com/cgi-bin/mailman/listinfo/ur" rel="noreferrer" target="_blank">http://www.impredicative.com/<wbr>cgi-bin/mailman/listinfo/ur</a><br>
<br></blockquote></div><br></div>