How to stop episerver database to store confirm email field value

Ash
Ash
Vote:
 

Hi,

I am using form elments to create form and i create a custom control(EmailConfirmation field) to validate email field, but now EmailConfirmation field value is also storing in my cms. I don't want to store that value.

#207731
Oct 01, 2019 14:39
Vote:
 

Let your custom form element implement the interface IExcludeInSubmission.

#207737
Edited, Oct 01, 2019 15:12
Vote:
 

I created an email validation element which implemented the TextboxElementBlock base.  The view has two required input boxes, which are validated using JQuery when the form is submitted.  But because the element implements the textbox element, only a single element is stored to the database.  In the view, I use the "data-f-element-name" property of the wrapper div to specify which field value is written to the database.

#207743
Oct 01, 2019 15:25
Ash
Vote:
 

Hi Tomas,

Can you please explain with code?

#207758
Oct 02, 2019 8:29
Vote:
 

ash, you write that you have created a custom EmailConfirmation field. If you have created that in code, it could look something like this:

[ContentType(
    DisplayName = "Emailconfirmation",
    GroupName = "Form Elements")]
public class EmailconfirmationElementBlock : TextboxElementBlock
{
   ...
} 

Just add IExcludeInSubmission, like this:

[ContentType(
    DisplayName = "Emailconfirmation",
    GroupName = "Form Elements")]
public class EmailconfirmationElementBlock : TextboxElementBlock, IExcludeInSubmission
{
   ...
} 
#207759
Edited, Oct 02, 2019 8:36
Ash
Vote:
 

Thanks Tomas. It is working.

#207773
Oct 02, 2019 17:45
- Oct 02, 2019 17:49
Excellent!
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.