[Ur] Forms that call rpc instead of redirect

Aistis Raulinaitis sheganinans at gmail.com
Mon Feb 12 21:03:39 EST 2018


Artyom. Not Yartom. I appologize. Thats what happens when you don't double
check your names!

On Feb 12, 2018 17:57, sheganinans at gmail.com wrote:

Thank you Ziv and Yartom!

Ziv, I'll take some time to see if I can get your example working with what
I have. This would be nice to get working.

Yartom, your snapshot function looks very close to what I need. Monad.mapR
is a function I should probably start using more. Thanks!

On Feb 11, 2018 21:31, "Artyom Shalkhakov" <artyom.shalkhakov at gmail.com>
wrote:

Hello Aistis,

2018-02-12 4:03 GMT+06:00 Aistis Raulinaitis <sheganinans at gmail.com>:

> Yes I did get a little demo working with ctextbox, cchecbox, and the like.
> However the result is much more verbose and more likely to have runtime
> errors over a regular form.
>
> 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.
>
>
FWIW, you can define something like this:

https://github.com/ashalkhakov/urweb-projects/blob/master/meter/screens.ur#
L163

and then use it like this:

https://github.com/ashalkhakov/urweb-projects/blob/master/meter/screens.ur#
L192

And it's not too bad.


> Losing the form submit struct typing mechanism and the added verbosity of
> all the sources would be very painful if you are expecting the majority
> of your forms to be of this style. Which I am.
>
> On Feb 11, 2018 13:20, "Adam Chlipala" <adamc at csail.mit.edu> wrote:
>
>> I think that kind of form has gone out of style, and I personally almost
>> always use the Ur/Web tags like <ctextbox> to collect data and then choose
>> RPCs programmatically.
>>
>> On 02/11/2018 04:10 PM, Aistis Raulinaitis wrote:
>>
>>> The form mechanism is excellent, with the built in type checking, but
>>> the submit action function returns a page: state -> transaction page.
>>>
>>> Is there such a thing such as a version of forms that has a submit
>>> action function with a type of: state -> transaction unit.
>>>
>>> This is so I can call rpc functions there in the submit action and then
>>> the current page is updated using responses over a channel from the server.
>>>
>>
>>
>> _______________________________________________
>> Ur mailing list
>> Ur at impredicative.com
>> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
>


-- 
Cheers,
Artyom Shalkhakov

_______________________________________________
Ur mailing list
Ur at impredicative.com
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20180212/a631d909/attachment.html>


More information about the Ur mailing list