<div dir="ltr"><div><div><div><div>Hello, regarding forms, what is the signature of r for the record that is passed to the handler function?<br><br></div>I am trying to do something like:<br><br></div><submit value="Add Employer" action={Employers.add}/><br><br></div>I have defined a module below for the purpose, but compiling gives an error pointing at the following line:<br><br>      val getList = queryL1 (SELECT * FROM tblEmployers)<br><br><br></div><div>for which I have defined the signature to be:<br><br>     val getList:  transaction (list {Id : int, Description : string, From : string, To : string})<br><br></div><div>Following the example in Fig 1 of Ur/Web: A Simple Model for Programming the Web.<br><br></div><div>I do think this is fine, but that maybe the error is for the next function:<br><br>      val add:      unit -> transaction unit<br><br></div><div>Who's purpose is to be the handler for a form submit. After looking at the manual, basis.ur and top.ur, I am still not certain which type r (the record created by submitting a form).<br><br></div><div>If someone could give me a tip that would great.  Below is the full code for my module.<br></div><div><div><div><div><div><div><div><br>structure Employers: sig<br><br>  (* Function that returns a list of employers from table tblEmployers *)<br>  val getList:  transaction (list {Id : int, Description : string, From : string, To : string})<br><br>  (* A handler for "Add Employer" form button *)<br>  val add:      unit -> transaction unit<br><br>  (* Function that takes a employer ID and removes it from table tblEmployers *)<br>  val remove:   int -> transaction unit<br>end = struct<br><br>  (* A sequence to generate unique employer ID *)<br>  sequence uidEmployer<br><br>  (* A table of employers *)<br>  table tblEmployers : {Id: int, Description: string, From: time, To: time}<br><br>  val getList = queryL1 (SELECT * FROM tblEmployers)<br><br>  fun add r = val nextId  = nextval uidEmployer <br>              dml (INSERT INTO tblEmployers (Id, Description, From, To)<br>                   VALUES ({[nextId]}, {[r.Description]}, {[r.From]}, {[r.To]}))<br>              <br>  fun remove uidEmployer = dml (DELETE * FROM tblEmployers WHERE t.Id = {[uidEmployer.Id]})<br>end<br></div></div></div></div></div></div></div></div>