Creating unobstrusive form action links

Dec 9, 2011 at 6:47 PM


This library is fantastic! Probably a lot of people already used this pun, but this is really awesome! Is simplifies a lot coding, and the examples made me a better .NET developer. Now, I have a question regarding the use of PopupActionLink and PopupFormActionLink.

FWIK it always create links in the format <a href="javascript:callpNAME()">Text</a>, which triggers a function that calls $.get('/Controller/Action/').

Well, that being said, I believe it would be wonderful if the anchor tags were created in an unobstrusive way. Which means the resulting link would be: <a href="/Controlle/Action/" onclick="javascript:function(){ callpNAME(); return false; }">Text</a>.

Why? Two reasons: first, I can write my actions to identify whether they were called by Ajax, so I can deliver a View or a PartialView, and keep my application accessible. And with this change, we can use the middle mouse button (or control/shift click) to open the link in a new page or tab, approprietly.

Thanks in advance,


Dec 9, 2011 at 8:39 PM

I submitted patch #11050 to address this change. Please evaluate it and verify whether this is a good improvement.

Dec 9, 2011 at 9:43 PM

New submission (#11051), setting the unobstrusive as optional parameter.

Dec 10, 2011 at 6:45 PM

there is a PopupFormAction 

and PopupAction Url helpers

they will return only the callpNAME()

so you could create any link/form any way you want