james
-
10/14/2005 4:42:24 AM
Template problem when creating a new document (and solution)
Hello, I've just downloaded and installed the trial version (1.7.2091), but was unable to create any new pages. I applied the changes to allow multilingual support, but when attempting to create a French version, I was unable to save due to two template error.
Problem #1 Selected a page under "en-us", then switched the language drop down to French. Left the "Prefill values with data from the default culture version" checkbox set and pressed the create button. The brought me to the Create a New Document page, which had many think pre-filled including the "Page Template". Pressed OK on this form, and received the error "Please choose some page template.", and the page template value had now disappeared.
Solution In CMS_MenuItemType.ascx, I removed the read only attribute from txtPageTemplate. Although this now made the page template box editable (the hidden field is used anyway), pages would then save without any errors.
Problem #2 Pressed the Select button to change the template. On the popup, picked a template, pressed OK, and a javascript error appeared. Didn't capture the exact message, but it was to do with getElementById
Solution The txtPageTemplate textbox and hidPageTemplateAspx hidden field are rendered with IDs of CMSForm1_ctl00_MenuItemType_txtPageTemplate and CMSForm1_ctl00_MenuItemType_hidPageTemplateAspx, however the SelectTemplateListing.aspx page is trying to update controls with IDs of CMSForm1__ctl0_MenuItemType_txtPageTemplate and CMSForm1__ctl0_MenuItemType_hidPageTemplateAspx.
Changing Line 112 in SelectTemplateListing.aspx.cs as follows corrected this problem RunScript( " opener.document.getElementById('CMSForm1__ctl0_MenuItemType_hidPageTemplateAspx').value = '" + Strings.Replace( this.lstTemplates.SelectedValue, "'", @"\'", 1, -1, (Microsoft.VisualBasic.CompareMethod)(0) ) + "'; " + "opener.document.getElementById('CMSForm1__ctl0_MenuItemType_txtPageTemplate').value = '" + Strings.Replace( this.lstTemplates.SelectedItem.Text, "'", @"\'", 1, -1, (Microsoft.VisualBasic.CompareMethod)(0) ) + "';window.close();" ); to RunScript( " opener.document.getElementById('CMSForm1_ctl00_MenuItemType_hidPageTemplateAspx').value = '" + Strings.Replace( this.lstTemplates.SelectedValue, "'", @"\'", 1, -1, (Microsoft.VisualBasic.CompareMethod)(0) ) + "'; " + "opener.document.getElementById('CMSForm1_ctl00_MenuItemType_txtPageTemplate').value = '" + Strings.Replace( this.lstTemplates.SelectedItem.Text, "'", @"\'", 1, -1, (Microsoft.VisualBasic.CompareMethod)(0) ) + "';window.close();" );
I didn't notice any other posts about this problem, so maybe it's only me who is experiencing this behaviour, but thought I'd post the solutions which I discovered incase there were others.
James.
|