I am playing with Sparkview 1.0 on ASP.NET 4.0 with MVC2. Trying to create a simple HTML form.
When the form loads, it renders as expected. Click Save button on the form, the model validates, returns an error about length of field (expected) but then the !{ Model.Name } tag gets rendered as the text ${ Model.Name } rather than the actual expected output of "test blah blah".
Where can I find an example of creating HTML forms using the HTML helpers with Sparkview?
!{ Model.Name }
${ Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") }
# Html.BeginForm();
<fieldset>
<legend>Fields</legend>
<p>
<label for="Name">Name:</label>
!{ Html.TextBox("Name", Model.Name) }
</p>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
# Html.EndForm();
And here is the controller method:
[HttpPost]
public ActionResult Add(Project project)
{
if(ModelState.IsValid)
{
// save to db
Response.Redirect("/");
}
ViewData["Model"] = project;
return View();
}