[Ur] A few questions about form submission

Adam Chlipala adamc at impredicative.com
Mon Apr 30 07:59:28 EDT 2012


Edward Z. Yang wrote:
> 1) I'd like to make a form which makes a GET request to a page
> (so it takes unrestricted URL input, but the landing page is bookmarkable).
> <form>  appears to do POST by default and as far as I can tell
> there's no way to tweak that, and obviously the AJAX ones are
> not suitable.

It's an interesting question whether the Ur/Web implementation should 
change to support this usage mode directly, but there is a simple 
indirect solution:

Build a form handler that calls [redirect] on a regular page handler.  
As Marc suggested, you can use the 'safeGet' .urp directive to override 
the rules about no side effects in GET processing, though this would 
generally be a bad thing UI-wise, I think.  Ideally your form handler is 
manifestly pure (in terms of non-local side effects) to begin with.

> 2) When I have a ctextbox, I'd like an event to trigger when the
> user presses enter.  Is there an easy way of doing that?

The usual 'onkey*' events should suffice.  Presently you have to use 
numeric keycodes directly.



More information about the Ur mailing list