I'd also suggest to go straight to T4MVC for some strongly typed goodness :)
http://t4mvc.codeplex.com/ Neil. On 4 November 2013 15:58, GregAtGregLowDotCom <g...@greglow.com> wrote: > Thanks guys. I was suspecting that’s roughly what’s needed. I had just > found that I could name a form, similarly to what you had mentioned so that > was a good start. > > > > I’ll try the script. > > > > Regards, > > > > Greg > > > > Dr Greg Low > > > > 1300SQLSQL (1300 775 775) office | +61 419201410 mobile│ +61 3 8676 4913fax > > SQL Down Under | Web: www.sqldownunder.com > > > > *From:* ozdotnet-boun...@ozdotnet.com [mailto: > ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Tony Wright > *Sent:* Monday, 4 November 2013 4:51 PM > *To:* 'ozDotNet' > *Subject:* RE: Basic MVC4 question on Form Post > > > > Add an id to your BeginForm statement, in case you have a second form to > the page (there’s usually a separate form tag for logout button, if I > recall correctly.) > > > > using (Html.BeginForm("foo", "bar", FormMethod.Post, new { id = "myID" })) > > > > You need to add a click handler to the span containing the text and then > perform a form submit there, referencing the id tag. > > You can add the click handler in the document.ready. > > > > $(document).ready(function () { > > $('body').on('click', '#mySpanId', function () { > > > > $("form#myID").submit(); > > > > }); > > > > This is off the top of my head and is only one possible solution. You > might need to check the syntax. > > > > *From:* ozdotnet-boun...@ozdotnet.com [ > mailto:ozdotnet-boun...@ozdotnet.com <ozdotnet-boun...@ozdotnet.com>] *On > Behalf Of *GregAtGregLowDotCom > *Sent:* Monday, 4 November 2013 4:33 PM > *To:* ozDotNet > *Subject:* Basic MVC4 question on Form Post > > > > Hi Folks, > > > > I’m still getting my head around MVC4 bit by bit. A quick question if I > can: > > > > If I have a form declared: > > > > @using (Html.BeginForm("SomeAction", "SomeController”, FormMethod.Post)) > > { > > > > } > > > > I would normally just post it by using an input button set to submit. > However, if I don’t want to use a button but want to make the form post > when someone clicks on some text in a div contained in the form, how do you > do that? Do you have to make an onclick for the div execute some java to > post the form? If so, how would you select the form using jQuery in this > case? (If I code forms myself, I can give them a name but this Html helper > doesn’t seem to have a name). > > > > Thanks! (I’ll be back to databases where I know what I’m doing soon J) > > > > Regards, > > > > Greg > > > > Dr Greg Low > > CEO and Principal Mentor > > *SQL Down Under* > > SQL Server MVP and Microsoft Regional Director > > 1300SQLSQL (1300 775 775) office | +61 419201410 mobile│ +61 3 8676 4913fax > > Web: www.sqldownunder.com > > > > >