Howdy.
I'm new to both ASP.Net MVC and jQuery and what I'm trying to do is make a form that either adds a new RockBand or updates an existing RockBand based on if the rockbandid is an empty guid or not. I figured now is a good time to get rolling with jQuery. So the first step is to make a list of bands and put an edit link next to it. If the user clicks on the edit link I want to alter the value of the input box and the hidden field. The code below is the first step, trying to set the value of the input box (with a fixed string for the moment but eventually would be whatever the band name is). However I get an Object Required Error when I do so. (The jQuery include is on the Site.Master)
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
function fillinbandname(thebandname) {
$('#bandname').val(thebandname);
}
</script>
<ul>
<%foreach (DomainModel.RockBand rockband in ViewData.Model) %>
<%{ %>
<li><%=rockband.BandName %> <a href='javascript:fillinbandname("somesamplevalue");'>edit</a></li>
<%} %></ul>
<%Html.BeginForm("MakeOrUpdateRockBand", "Bands", FormMethod.Post); %>
<input type="text" id="bandname" name="bandname" maxlength="30" />
<input type="hidden" id="bandid" name="bandid" value="00000000-0000-0000-0000-000000000000" />
<input type="submit" value="Add New Band" />
<%Html.EndForm(); %>
</asp:Content>
It feels like I'm soooo close...but am missing something fundamental.