DarthFubuMVC/fubumvc — pull request #158 by Linkgoron (2011-10-20 02:47:58+00:00)
Title: Form html conventions

Hi,

I posted about conventions in Forms a few days ago http://groups.google.com/group/fubumvc-devel/browse_thread/thread/a9ca8d16df88d445 , and I took a shot at an implementation.

One of my main goals is 100% compatibility with how stuff worked before. I don't want anything breaking for anyone.

I've had some problems with Accessors etc, and with the fact that FormFor is different from other page extensions because it doesn't work with expressions, but with actual objects.

That's why I, sadly, had to create more changes than I wanted to, but that's life.

Anyway, this isn't ready yet, I've got some tests (to fix up, and lots to add) and some caching and tightening, however I'd like to ask you guys if this is approach is even acceptable, just so I'd know if there's any need for me to actually continue on working.

There's also the question of string URLs. I'd like to support relative string urls (not just input models/method expressions), and I couldn't find out how to get from a relative url to a behavior chain.

Just to show that it works for my intended purpose, I've also added a AntiForgeryFormModifier class, so you can write something like this *Form.Modifier()* in your html conventions, and you get antiforgery tokens.

Hope my code isn't too embarrassing :).

Linkgoron.

P.S

I've been thinking about having conventions on the FormEnd, however this poses some problems as I'd need some kind of context between the form begin, and the form end. This might be implemented in a ASP.NET mvc-style form with a disposable object, or with a service location (meh), or something else... So any ideas would be helpful.