[Ur] Minimal example generating a node id with fresh and using it in a form handler

Stefan Scott Alexander stefanscottalexx at gmail.com
Thu Aug 6 12:45:43 EDT 2015


Hi -

I'm trying to do a minimal example:

- generating a node id using [fresh] - from section 8.6.2 of the manual; and

- using the node id in a form handler - similar to the Form demo:

  http://www.impredicative.com/ur/demo/form.html

(This is in preparation for other code which will use JavaScript FFI.)

My minimal code is something like the following, but it does not compile
due to the obvious syntax errors involving [nid].

fun main () =
  nid <- fresh;
  let
  fun handler r =
    return
      <xml><body>
        {[r.nid]}
      </body></xml>
  in
    return
    <xml><body><form>
      <textbox{nid}/>
      <submit action={handler}/>
    </form></body></xml>
  end

I can't figure out the correct syntax, for:

- using [nid] created by [fresh] and as the id for a textbox; and

- accessing the value in the textbox, via a form handler.

Thanks for any help!

###
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150806/6865028d/attachment.html>


More information about the Ur mailing list