Html.ValidationMessageFor

Topics: General, MVC, Troubleshooting
Jan 30, 2011 at 10:59 AM

Any idea why 

@Html.ValidationMessageFor(model => model.MyProperty)

doesn't generate 

<span class="field-validation-valid" data-valmsg-for="MyProperty" data-valmsg-replace="true"></span>
in CompositeC1? Same code works in normal MVC3 razor application. I'm trying to use client side validation in unobtrusive mode.

Coordinator
Jan 30, 2011 at 9:22 PM

Can you post a complete sample that works ok on a std. MVC3 site, but not in Composite C1? We a good repro we can dive into it :)

Jan 31, 2011 at 3:30 AM

Download links: MVC3 Application and Composite Package 

The path for the MvcPlayer function is "/MVC3Sample".

My Composite version is : Composite C1 2.0 SP1 Patch 1 Build no. 2.0.3980.20024

 

 

Feb 1, 2011 at 8:00 PM

Any update guys?

If you point me to the part that is responsible for passing/parsing HTML markups then maybe I'll be able to start some source debugging.

Cheers.

Coordinator
Feb 1, 2011 at 11:28 PM

Sorry for the silence - we will investigate issue, but you are very welcome to investigate along with us.

You will find the code for MvcPlayer in ~/App_Code/Composite/AspNet/MvcPlayer/Player.cs - it is just 159 lines. "public static XDocument Render(string Path)" is the entry point from Composite C1 to this function.

If the problem seems to stem from the Composite C1 core, try running with the source code version, set a break point in the MvcPlayer and backtrack into the code.

We will keep you updated on what we find :)

Feb 2, 2011 at 7:47 AM

Thanks for the tips.

Apparently the context is OK before entering TidyHtml on line 85 in Paler.cs

TidyHtmlResult tidyHtmlResult = MarkupTransformationServices.TidyHtml(responseWriter.ToString());

After this point the empty span elements which are being used for validation messages will be removed. Even if I manually insert an empty span like 

<span></span>
 it will be removed.

I'm going to dive into the source to see what I can get.

Coordinator
Feb 2, 2011 at 8:50 AM

I think Tidy should be kicked out here... try to remove any use of MarkupTransformationServices.TidyHtml and TidyHtmlResult (anything named Tidy).

Feb 8, 2011 at 6:26 AM

Hi Marcus,

It's been a while and I had passed a very busy week. Now that the pressure is at a lower rate I found some time to get back to this.

First of all, what do you mean by kicking out Tidy. It looks like this part of code does a serious job normalizing the content and BTW the input and out put are not even similar and I don't think taking this function out of the loop will do any good.

Also, I tried to run my website having source code referenced in order to debug and find the buggy part but when running it I receive a IO Configuration Section not found error message. Any clue what that means?

Cheers.