When editing a Sitecore item that contains HTML in the Display Name (e.g. Title), the HTML is encoded immediately. Editing Display Name a second time shows that <em>Title</em> has been converted to <em>Title</em>.
We don't have any custom code that would do this; is there a configuration parameter or something that would control how display name is encoded?
[EDIT]
To clarify, if I edit an item's Display Name to add HTML, and then edit it a second time, the HTML contained in the Display Name has been encoded. There are several older items that contain HTML in the Display Name field and it is rendered correctly.
For example, first I edit an item's Display Name to add emphasis tags...
...you can see how the Display Name is updated in the content tree.
However, if I edit the item again, Sitecore encodes the HTML as show below...
Oddly, there are other (older) items in the content tree that already have HTML in their Display Name, and the HTML is correctly rendered (see below item with tag in the display name).
My question is: what could cause the HTML to be encoded?
To answer the question "Why would you want to do this in the first place?", I would respond with the answer that this is legacy code that used to be working and is now suddenly not. I'm not building a new system; this is an existing web site that I'm troubleshooting.
Your question is a little bit confusing. What exactly are you expecting to see vs. what you are actually seeing? Display Name is a simple text field, it's not rich text... I don't believe Sitecore is doing any encoding here.
Now you can make Sitecore skip the decoding step for single-line text fields by removing the Sitecore.Pipelines.RenderField.GetTextFieldValue from the renderField pipeline. Then you'll get exactly whatever is in that field rather than <em>Title</em>
OK, I think I get why your question is confusing me now. The input from you question was decoded?
EDIT: BTW, this pipeline entry GetTextFieldValue was a recent addition... some time between 6.3 and 6.6.
Related
Inside my custom save action, I iterate through the form fields (the AdaptedControlResult objects). Any form field which is a DropList (from any source -- manually entered values, or an item lookup) is returning a string value of System.Collections.Generic.List`1[System.String]
Now, it's important to know, it's not returning an actual List. It's returning a literal string with that value.
So, this call:
fields.GetEntryByName("MyFieldName").Value
Is returning the string: System.Collections.Generic.List`1[System.String]. Not the value of the dropdown. A string saying that's it's a List<string>.
I have confirmed the HTML of the form is rendering correctly. I have manually checked the inbound HttpContext.Current.Request.Form values as well...
HttpContext.Current.Request.Form["BGWnjkQqrE6w6sr31IgzrQ.Sections[5].Fields[0].Value"]
That is the correctly-selected value of the drop down (a Sitecore ID).
So, the data is getting output to the form correctly, and the inbound Request.Form data is also correct. Somewhere, Sitecore is deciding not to populate the selected value into the AdaptedControlResult object.
What's additionally odd is that for DropList field types, the selected value does appear in the Parameters property (inexplicably). I would just detect this and use it, but it's not consistent -- for instance, for textbox field types, the word "multiline" appears there.
All other field types work fine -- I have several text entry fields, and some radio button lists. It's just DropList fields.
What is the trick to getting this?
This is a known bug in Sitecore when using the WFFM module in MVC. You can find more details in this Knowledge Base Article - Incorrect data is saved for list fields in WFFM MVC.
The fix is listed on the kb article and depends on the exact version of Sitecore you are using. Sorry to provided a link only answer but there are multiple steps reqiured for the fix and the download for the fix is attached in the article.
I am new with Orchard and can not seem to get past this problem.
Goal
to be able to specify two text values on each page and show those in a styled DIV if they are not blank.
Procedure
I created a new content part in Orchard's admin named
"InnerPageTitleArea"
I added two fields to this part: IpTitle (Text Field) and IpSubtitle
(Text Field)
I added this part to the Page content type
Those textboxes show when editing a page, and I filled them in on
several pages
Those values show on pages they were entered on (all good so far)
The problem:
I want to provide a template for the InnerPageTitleArea, but all
attempts have failed.
When using shape tracing, there are no alternates referencing my
part alone
All alternates begin with "Fields" i.e.
~/Themes/MyTheme/Views/Fields.Common.Text-InnerPageTitleArea.cshtml.
If I use one of those field alternates, my template is repeated
twice - once for each field
If I use a field-specific template, i.e.
~/Themes/MyTheme/Views/Fields.Common.Text-InnerPageTitleArea-IpTitle.cshtml
I can actually get at both values, but then the other value
(IpSubtitle) still displays as plain text. I could probably remedy
that with Placement.info, but I suspect that I am just lacking some
fundamental understand of Orchard.
What to do?
Your part never renders anything because it doesn't have a driver that would create a shape. The only shapes that are getting out of that part are the shapes for each of the fields. The simplest way to get what you want is to create one alternate for each of the fields. Would that work?
We have a form with a dynamic running totals table beneath the form. For example, when a user changes a value in the Quantity field, the running totals update based on the input (via javascript). The table is displayed only, nothing is saved in the database
We want to be able to generate a pdf that includes the updated running totals. Basically I'm searching if there is some way to pass the current innerHTML within a div to a pdf.
This may have been already asked and answered here- Generate pdf from current document , but the user didn't specifically say that the form updates data after the initial page load. So I just want to be sure I'm not missing something. Thanks. I have a feeling I should look into localStorage for this.
(From the comments)
I think you may be over-complicating the PDF functionality. It is not necessary to keep up with the local changes that the users make as far as generating a PDF is concerned. Most likely the users will make whatever changes to the page and then click a link/button to generate a PDF only after completing all of the changes. At that point you could simply submit a form with all of the updated values to ColdFusion and generate your PDF file. Instead of/or in conjunction with updating the innerHTML of a div, update the hidden form fields as well. Then on the ColdFusion server you could use something like the CFDocument tag to create your PDF from the form fields that were submitted. (Remember to validate all of the form field data before using it.)
I'm creating localizations--in Spanish and Chinese--for a Sitecore site. The original language is English. I've learned how to create my language-specific versions of pages. But I don't know how to change the names of the the navigation items themselves. When I preview my pages in Spanish (http://content.example.com/?sc_lang=es), for example, the page content is in Spanish, but the navigation items themselves (e.g. Home, About, Products, etc.) are still in English. Where in the Content or Page editors do I fix that?
You need to modify the "display name" of the item in the Home ribbon. Be aware that this also affects the url of the item For the chosen language.
Edit: maybe I was too quick with my answer, I probably overread something cause my suggestion changes the Url (if you have the setting "useDisplayName=true" like jammykam corrected) and the name of the item in the content tree for the specific language.
If your the names displayed in the navigation is based on the Item names, then can do as I suggested, change the display item's name for the current language and make the code look at the display name inestead of the item name.
Another option is to use a separate field for the menu-title in case you want your titles to differ from your url's.
When you say the navigation items themselves are in still in English, what do you mean? As in, the menu running along the top of the page?
If so, then you need to figure out where in the content tree those items are and then add in the relevant language versions/translations, and make sure they are not "shared" content.
#Martijn, I believe it only affects the URL is you set "useDisplayName=true" in the linkManager setting in config.
We usually add a field called MenuTitle to the base content template and then instruct our navigation controls to read from that field
For menus, we generally use a different field for the page's title and the page's navigation title. This allows for a shorter version to be specified by the author for the menu.
Once you have that, you just need to make sure you build code in your header control to find the target item of the menu link (I assume it's a general link, or some other Item reference) and pull the target item's navigation title.
When the code does this, it should automatically pull the version of that target item based on the current language, which will mean you will get your navigation title in the correct language.
I'm busy writing a sitecore solution to manage a news site. I have a NewsArticleLayout (used to display a NewsArticle item), with a NewsArticleMailPlaceholder which I want to use to display a form where a user can enter a name and email address where a news article link must be mailed to.
On the NewsArticleLayout page is already a NewsArticleSublayout with a phNewsArticle placeholder, which is currently correctly displaying data related to a news article.
When I try to link the form to this placeholder, I only seem to be able to link to placeholders in sublayouts, not in layouts, so I created a MailNewsArticleSublayout, and placed a phMailNewsArticle placeholder on it. Then I told the form to display on the NewsArticleLayout, using the MailNewsArticleSublayout, and the phMailNewsArticle placeholder.
However, when I view the page, my form doesn't display. I've done a full publish of my entire Sitecore content tree, nothing seems to fix it.
I've even added a phEmail placeholder to the NewsArticleSublayout, and linked this to the form layout details, but this also doesn't display anything.
Have I correctly setup my form's layout? Is there something I'm missing here?
After speaking to sitecore support, I was able to resolve the issue. What I was missing was adding "Form" to the layout details on the standard values for my template. Then in this Form element, fill in the actual Form's location in the "FormID" field. After adding this, it worked perfectly.