More in this section
Forums / Bugs & Issues / Validation Failing in a Customized Registration Form Template

Validation Failing in a Customized Registration Form Template

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
6 posts, 0 answered
  1. Yosief
    Yosief avatar
    27 posts
    20 Mar 2008
    31 Jan 2013
    Link to this post

    Hi All

    I have added some validation to the default registration form template in the following way:

    <sf:TextField ID="firstName" runat="server" DataFieldName="FirstName" DataItemType="Telerik.Sitefinity.Security.Model.SitefinityProfile" DisplayMode="Write" Title="<%$ Resources:Labels, FirstName %>" CssClass="sfregisterField sfregisterFirstName" WrapperTag="li">               

    <validatordefinition  messagecssclass="sfError" required="true" />         


    For some unknown reason, there is no validation happening for the above field when the form is submitted. The only validation happening is for email, username and password.

    I later added validation group to each of the required fields in the form. Still no validation happening for the rest of the fields e.g. First name,  Last name etc..

     Any idea why this happening??


  2. Jen Peleva
    Jen Peleva avatar
    568 posts
    10 Nov 2016
    04 Feb 2013
    Link to this post
    Hello Yosief,

    If you for example have the following custom field and you want to validate it:

    <sf:TextField ID="reTypeEmail" runat="server" DisplayMode="Write" Title="Retype Email" IsPasswordMode="true" CssClass="sfregisterField sfregisterConfirmPassword" WrapperTag="li">
                  <ValidatorDefinition MessageCssClass="sfError">
                          <sfvalidation:ComparingValidatorDefinition ControlToCompare="email"
                              Operator="Equal" ValidationViolationMessage="Please enter the same email"/>

    The default registration form control doesn't validate custom fields.You should override its ValidateInput() method of the control  to return true when your field is validated. You can see how this is done in the sample:
    protected override bool ValidateInput()
                return base.ValidateInput() && this.ReTypeEmailField.IsValid();

    To do that you should simply inherit from our Registration form and override the above method.

    Jen Peleva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Mansoor
    Mansoor avatar
    52 posts
    29 Jul 2013
    04 Sep 2013 in reply to Jen Peleva
    Link to this post
    Hi Jen,

    Where can i add this method validateInput() in the  solution. If i want to add validation for custom feilds. where have to write the code.

    Please help us.

  4. Nayden
    Nayden avatar
    11 posts
    22 Feb 2013
    10 Feb 2014 in reply to Mansoor
    Link to this post
    Hi Mansoor,
    about the validateInput() method :
    The method is inside the RegistrationForm control.

     Because of that you need to extend this control by creating your own custom MonsoorRegistrationForm : RegistrastionForm and override this method as Zheyna suggested.

    Then you can go and replace the default control in the toolbox to be your instead of the sitefinity one.
    Go to >> Administration >> Settings >> Advanced >> Toolboxes >> Toolboxes >> PageControls >> Sections >> Users >> Tools >> RegistrationWidget and change the value of CLR Type or Virtual Path field.

    From now on every time you place an registration widget to a page or layout it will use your widget implementation and your validate method

    Nayden Gochev

  5. Roshith S
    Roshith S avatar
    0 posts
    05 Sep 2016
    26 Sep 2016
    Link to this post
    I want to set a field as unique. Sitefinity by default does not have any provisions for doing that.  Eg:Username field. No two users must have same usernames. 
    Can anyone tell how to achieve it efficiently. 
    Thanks in Advance
  6. Sylwia
    Sylwia avatar
    0 posts
    08 Dec 2017
    17 Dec 2017
    Link to this post
    no one ever done a unique validation? i am digging the forums with poor results :(
6 posts, 0 answered