November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi!
In the submit button element I find this:
@*
====================================
Version: 5.0.0.0. Modified: 20210818
====================================
*@
@using EPiServer.Forms.Implementation.Elements
@using EPiServer.Forms.Helpers.Internal
@model SubmitButtonElementBlock
@{ var formElement = Model.FormElement;
var buttonText = Model.Label;
var buttonDisableState = Model.GetFormSubmittableStatus(ViewContext.HttpContext);
var cssClasses = Model.GetValidationCssClasses(); }
<button id="@formElement.Guid"
name="submit"
type="submit"
value="@formElement.Guid"
data-f-is-finalized="@Model.FinalizeForm.ToString().ToLower()"
data-f-is-progressive-submit="true"
data-f-type="submitbutton"
data-f-element-name="@formElement.ElementName"
@Html.Raw(Model.AttributesString)
@buttonDisableState
class="@(Model.Image == null ? "Form__Element FormExcludeDataRebind FormSubmitButton " + cssClasses : "Form__Element FormExcludeDataRebind FormSubmitButton FormImageSubmitButton " + cssClasses)">
@if (Model.Image == null)
{
@buttonText
}
else
{
<img src="@Model.Image.Path" data-f-is-progressive-submit="true" data-f-is-finalized="@Model.FinalizeForm.ToString().ToLower()" alt="@buttonText" />
}
</button>
and the disabled button comes from this:
var buttonDisableState = Model.GetFormSubmittableStatus(ViewContext.HttpContext);
And tha code is this:
public string GetFormSubmittableStatus(HttpContext context)
{
string empty = string.Empty;
SubmittableStatus submittableStatus = _dataSubmissionService.Service.GetSubmittableStatus(FormElement.Form, context);
if (submittableStatus == null)
{
return empty;
}
if (!submittableStatus.Submittable)
{
return "disabled";
}
return empty;
}
and this:
public virtual SubmittableStatus GetSubmittableStatus(IForm form, HttpContext context)
{
if (context == null || form == null)
{
return new SubmittableStatus
{
Submittable = false,
Message = LocalizationService.GetString("/episerver/forms/messages/formsubmission/outdatedforminit")
};
}
if (IsMalFormSteps(form))
{
return new SubmittableStatus
{
Submittable = false,
Message = LocalizationService.GetString("/episerver/forms/viewmode/malformstepconfigruation")
};
}
if (!form.AllowAnonymousSubmission && (IsAnonymousAccess(context) || !_aggregatedPersonalizationEvaluator.Service.Personalize()))
{
return new SubmittableStatus
{
Submittable = false,
Message = LocalizationService.GetString("/episerver/forms/messages/formsubmission/requirelogin")
};
}
if (!form.AllowMultipleSubmission && HasAlreadyPosted(form.FormGuid, context))
{
return new SubmittableStatus
{
Submittable = false,
Message = LocalizationService.GetString("/episerver/forms/messages/formsubmission/denymultisubmit")
};
}
if (_submissionStorageFactory.Service.GetStorage(new FormIdentity
{
Guid = form.FormGuid
}) is SessionStorage && context?.Features.Get<ISessionFeature>() == null)
{
return new SubmittableStatus
{
Submittable = false,
Message = LocalizationService.GetString("/episerver/forms/messages/formsubmission/sessionoff")
};
}
return new SubmittableStatus
{
Submittable = true,
Message = ""
};
}
But in the last code I cannot find anything about the "Save postings" checkbox.
Why is that code returning false if I don't check the "Save postings" checkbox? I don't get it.
Our form allows anonymous submits.
The error message in Swedish is:
"Möjligheten att spara data för det här formuläret har stängts av."
Thanks!
/Kristoffer
Got an answer from Optimizely support that directed me here:
https://webhelp.optimizely.com/18-5/addons/episerver-forms/creating-a-form.htm
If "Store form submissions" is not enabled the anbser will be stored in the users session. If Session state for you application is disabled the form cannot be submitted.
Session state is disabled per default in net core and this is how you enable it:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/app-state?view=aspnetcore-6.0
Thanks Hui Shi in the Application Support Team.
/Kristoffer
Hi!
After upgrading from 11 to 12 I cannot longer submit Forms if the checkbox "Save form entries" (freely translated from Swedish) is not checked.
If the checkbox is not checked I get an message that says: "The ability to save data for this form has been turned off." and the submit button is disabled.
If I check the box I can submit the form and the message dissapears.
Any ideas what I am missing?
Thanks!
/Kristoffer