No builtuin way as far as I now. I think you would need to modify the EPiServer dialogs directly.
Although possible to reflect the code, add new vpp mappings for the new aspx files etc to add this functionality it's not recommended in any way.
I rewote parts of xform for EPiServer 5 because of some severe performance bugs in that version. It will however make it much more difficult to upgrade, maintain the site so don't go down that road unless you really (x 10) have to. Suggest it as a feature in next version instead and simply tell the customer that it's not supported with xforms yet
Hi Robert,
I agree with Per and Daniel that no offical way (simpler way) to do that.
You can workaround as below:
void PageBase_PageSetup(PageBase page, PageSetupEventArgs e)
{
if (IsXFormEditPage())
{
page.PreRender += page_PreRender;
}
}
void page_PreRender(object sender, EventArgs e)
{
var page = sender as PageBase;
if (IsCreatingNewForm(page))
{
var formAnonymousPostControl = page.FindControl<CheckBox>("FormAnonymousPost");
var formMultiplePostControl = page.FindControl<CheckBox>("FormMultiplePost");
formAnonymousPostControl.Checked = true;
formMultiplePostControl.Checked = true;
}
}
private bool IsXFormEditPage()
{
var request = HttpContext.Current.Request;
var appRelativePath = request.AppRelativeCurrentExecutionFilePath;
var xformEditVirtualPath = string.Format("{0}{1}", Settings.Instance.UIUrl, "Edit/XFormEdit.aspx");
return VirtualPathUtility.Equals(appRelativePath, xformEditVirtualPath);
}
private bool IsCreatingNewForm(PageBase page)
{
return page != null && string.IsNullOrEmpty(page.Request["formid"]) && !page.IsPostBack;
}
in your InitalizeModule or Global.asax
Hope that help!
Ha Bui
Hi!
Thanks for your replies! I have solved it by adding the following code:
[InitializableModule]
public class XFormInitializationModule : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
XFormControl.ControlSetup += ControlSetup;
}
public void Uninitialize(InitializationEngine context)
{
XFormControl.ControlSetup -= ControlSetup;
}
public void Preload(string[] parameters)
{
}
private static void ControlSetup(object sender, EventArgs e)
{
((XFormControl) sender).ControlsCreated += ControlsCreated;
}
private static void ControlsCreated(object sender, EventArgs e)
{
var form = sender as XFormControl;
if (form != null && form.EditMode)
{
if (string.IsNullOrEmpty(form.FormDefinition.FormName))
{
form.FormDefinition.AllowMultiplePost = true;
form.FormDefinition.AllowAnonymousPost = true;
}
}
}
}
Comments?!
In "Edit Form" mode for an XForm there are 2 check boxes for "
How can I set these 2 check boxes to be set by default every time you create a new XForm?!