Tuesday, May 26, 2015

Control with no placeholder listed still renders on the page


Do not be alarmed! Even though I was when I started working on a bug for a client and looked at the Presentation Details on a Sitecore item that had a control with no placeholder. But when I took the control off the page content was gone. Conclusion was obvious - it was THAT very control that made certain things happen on the page. But how was it "attached" if there is no placeholder it goes into?





It was actually listed in the Placeholder field in the Data section on the sublayout item itself.



This is convenient and dangerous at the same time. Convenient because anywhere this control is used it would "know" to be placed in the same placeholder. Dangerous because you might intend to use a different placeholder but the same control in various places on the site.

Monday, May 18, 2015

Extra html tags breaking the page in WFFM 2.3

We all pay attention to a little red asterisk that means "field is required". But once in a while when the form is large or you are not paying attention it takes a couple of attempts to fill everything out correctly. And that's when the page breaks if you are filling out a checkbox list field on a WFFM form.

Suppose I have a form similar to this:


If I pick at least one option under Sample Options checkboxlist and leave of the required fields blank (i.e.City) and click Submit I would get a typical "required field" error. But if I click Submit again and leave any required field blank one more time I get the following exception:


This happens due to the code in Sitecore.Form.Web.UI.Controls.ListControl class inside assembly Sitecore.Forms.Custom, Version=2.3.0.0.


I made a custom class that overwrites the ListControl and doesn't have those tags in it. And the CheckboxList, also a custom one, inherits from it. This bug is fixed in the next version of WFFM (2.4).