I noticed the unit method was called in the onload in the body. In Logitext, analogous methods are always called in an <active> following the (in its case) <div id={nid}>. Perhaps the onload can't yet do anything to the element you set the nid on because it doesn't yet exist.<div><br></div><div>I think I put this pattern in a previous email, but here it is again. I think you'll want something like:</div><div><br></div><div><textbox{#Field} id={nid}/></div><div><active code={init nid; return <xml/>}/></div><div><br></div><div>More generally, we have the question of how best to interface with mutation-heavy JS libraries. You can make this seem a bit more declarative by writing a wrapper function (see [activate] in Logitext), <span></span>but maybe there are other approaches that are nicer in some ways (e.g. could the FFI be just a value of type [transaction xbody]?).</div><div><br><br>On Thursday, August 6, 2015, Stefan Scott Alexander <<a href="mailto:stefanscottalexx@gmail.com">stefanscottalexx@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="monospace, monospace">Thanks Ziv.</font><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">I added the following two lines to pikadayPage.urp:</font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace"> jsFunc PikadayControl.init=init</font></div><div><font face="monospace, monospace"> benignEffectful PikadayControl.init</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">The revised code is on the GitHub repo:</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> <a href="https://github.com/StefanScott/urweb-pikaday" target="_blank">https://github.com/StefanScott/urweb-pikaday</a><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Now the code compiles and runs - and if I type "foo" in the textbox and hit Submit, then the web app correctly goes to another page and displays "foo".</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">However, when I click in the textbox, it does *not* display a datepicker, so I must still be doing something wrong.</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">I think the code might be *close* to being correct, but obviously I haven't connected all the pieces together correctly. </font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">I'm purposely using this minimal example in the hopes that it might make it easier to pinpoint where the error is.</font></div><div><br></div><div>###</div><div><br></div></div>
</blockquote></div>