Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

nullable surname prefix #2035


User avatar
0
rvanwoezik created

Hi,

In the Netherlands, thanks to Napoleon Bonaparte, we have a surname prefix, like my last name is "Van Woezik" where "Van" is a surname prefix meaning "from".

In ..Core i have extended User with property "SurnamePrefix"

public virtual string SurnamePrefix { get; set; }

In ..Entity Framework i have added migration

public override void Up()
        {
            AddColumn("dbo.AbpUsers", "SurnamePrefix", c => c.String(nullable: true, maxLength: 12));
        }

When i try to add a new User in SPA, i can't save when there is no SurnamePrefix

What am I forgetting? Please advice, TIA, Rene van Woezik


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    What you have done seems correct. Do you get an error on server side ? If so, there must be error details in Logs.txt file under your web project.

    If you are unable to post your data from client side to server side, do you have a javascript error ? You can check browser's developer console.

    If you dont have any javascript error, can you share your SurnamePrefix input's html code ?

  • User Avatar
    0
    rvanwoezik created

    Hi,

    No errors serverside or javascript, just that the save button is disabled, if i fill in a random string in SurnamPrefix save button is enabled.

  • User Avatar
    0
    rvanwoezik created

    Oops! My fault. Found my mistake.

    ng-class="{'edited':vm.user.surnamePrefix}" ng-model="vm.user.surnamePrefix" required maxlength="@PhoogleZero.Authorization.Users.User.MaxSurnamePrefixLength">
                                    <label>@L("SurnamePrefix")</label>
                                </div>
    

    removed "required" in the razor page