Spark + MVC2 Validation

10 views
Skip to first unread message

HowardvanRooijen

unread,
May 10, 2010, 9:29:55 AM5/10/10
to Spark View Engine Dev
Hi,

has anyone managed to get Spark and MVC2 style client / server
validation working? I'd like to migrate from xVal to the new
validation framework - but I keep hitting brick walls.

Many thanks,

Howard

--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to spar...@googlegroups.com.
To unsubscribe from this group, send email to spark-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spark-dev?hl=en.

James Hughes

unread,
May 10, 2010, 9:32:12 AM5/10/10
to Spark View Engine Dev
There is no difference. Waht is you issue?

I basically used.

#Html.EnableClientValidation();
#using (Html.BeginForm("Edit", "Admin", FormMethod.Post, new { @class
= "k-form", id = "edit-form" }))
#{
<div id="k-form-desc">
<h2>Edit User</h2>
<p>Please update the user details below.</p>
</div>
${Html.ValidationSummary(true)}
<ul>
<li>
<label class="description" for="FullName">Full Name</label>
<div>
${Html.HiddenFor(m => m.UserId)}
${Html.ValidationMessageFor(m => m.FullName)}
${Html.TextBoxFor(m => m.FullName, new { @class = "element text
large", maxlength = 50 })}
</div>
</li>

On May 10, 2:29 pm, HowardvanRooijen <howard.vanrooi...@gmail.com>
wrote:

Ryan Roberts

unread,
May 10, 2010, 9:33:50 AM5/10/10
to spar...@googlegroups.com
Do you have a compelling reason to migrate from xVal? Other than it being new. Just worked on a new project with MVC 2 validation (and no spark unfortunately), it doesn't offer much over xVal. That said, it's just html extensions and should work in spark without modifications.

Howard van Rooijen

unread,
May 10, 2010, 10:30:35 AM5/10/10
to spar...@googlegroups.com
@James - thanks for that.
@Ryan - I'm trying to update the WhoCanHelpMe codebase - xVal hasn't seen an update in 6 months - the owner (Steve Sanderson) thinks that MVC2 has caught up and offers a good alternative - and it would be nice to remove another dependency headache of XVal & NHibernate.Validation.

Thanks for the help.

Howard

TMFReason

unread,
May 10, 2010, 3:13:13 PM5/10/10
to Spark View Engine Dev
I can also verify that Spark should work with all MVC2 validation
(excect perhaps custom templates for structs - as mentioned in another
thread). I did run into a few problems, but if I recall they were
just syntax and fixed by falling back to using # statements. Also
recall a problem of validation errors firing on initial load, but this
was not Spark specific.
Message has been deleted

Asbjørn Ulsberg

unread,
Jun 28, 2010, 5:33:56 PM6/28/10
to Spark View Engine Dev, Roman Smolnikov
Currently, you have to use the C# syntax for both
Html.EnableClientValidation() and Html.BeginForm() to make it work.
However, I feel that Spark is in need of client validation support. What
would be quite neat is something like:

<form client-validation="true">
</form>

Where the 'client-validation' attribute is parsed by Spark and with it
mimic the following quite horrible C# equivalent:

<% Html.EnableClientValidation() %>
<% using (Html.BeginForm()) { %>
<% } %>

Having something like this would be awesome. I'd add it myself, if I knew
where and how to do it.


-Asbjørn

On Fri, 25 Jun 2010 14:11:25 +0200, Roman Smolnikov <roma...@gmail.com>
wrote:

> Hi,
> how you call Html.EnableClientValidation(); on Spark?
> Do you have working client-side validation on Spark?

Reply all
Reply to author
Forward
0 new messages