Base solution for your next web application
Open Closed

Angular Validation not working on ASP.NET CORE & Angular .NET 5.0 v10.0.0 #9883


User avatar
0
christianharo created

ASP.NET CORE & Angular .NET 5.0 v10.0.0

Downloaded a brand new project .
Using the Power tools created a new entity with two properties ( required) , Used the option Create Non-Modal CRUD page.

Generated and run the application however the validation of the required fields doesn't work.

The applicaiton shows a Saved Succesfully but doesn't show errors abour the fields been required. Also there is no Form tag in the html ( not sure if this was intentional or a bug)


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

    Hi @christianharo

    Thanks, we will check this in a short time.

  • User Avatar
    0
    musa.demir created

    Created an issue about it. You can follow the progress in here: https://github.com/aspnetzero/aspnet-zero-core/issues/3636

  • User Avatar
    0
    musa.demir created

    Hi @christianharo
    I check it and it is by design. By default, if you do not enter a value to nonnullable property, the default value is set.

  • User Avatar
    0
    christianharo created

    Well no value es set as the record does not get created. And the message says created succesfully.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @christianharo

    Could you share the entity json with us ? You can find it under "aspnet-core\AspNetZeroRadTool" of your project.

    Thanks,

  • User Avatar
    0
    christianharo created

    I do not see an entity json file in that directory.

    image.png

    iIf you are refering to the templates please let me know. Thanks

  • User Avatar
    0
    christianharo created

    if you are refering to the entity i am working on ths will be the file:

    {
    "IsRegenerate": false,
    "MenuPosition": "main",
    "RelativeNamespace": "CcmMain",
    "EntityName": "Schedule",
    "EntityNamePlural": "Schedules",
    "TableName": "Schedules",
    "PrimaryKeyType": "int",
    "BaseClass": "Entity",
    "EntityHistory": false,
    "AutoMigration": true,
    "UpdateDatabase": true,
    "CreateUserInterface": true,
    "CreateViewOnly": true,
    "CreateExcelExport": false,
    "IsNonModalCRUDPage": true,
    "IsMasterDetailPage": false,
    "PagePermission": {
    "Host": true,
    "Tenant": true
    },
    "Properties": [
    {
    "Name": "ScheduleName",
    "Type": "string",
    "MaxLength": 150,
    "MinLength": 1,
    "Range": {
    "IsRangeSet": false,
    "MinimumValue": 0.0,
    "MaximumValue": 0.0
    },
    "Required": true,
    "Nullable": false,
    "Regex": "",
    "UserInterface": {
    "AdvancedFilter": true,
    "List": true,
    "CreateOrUpdate": true
    }
    },
    {
    "Name": "ScheduleType",
    "Type": "string",
    "MaxLength": 150,
    "MinLength": 1,
    "Range": {
    "IsRangeSet": false,
    "MinimumValue": 0.0,
    "MaximumValue": 0.0
    },
    "Required": true,
    "Nullable": false,
    "Regex": "",
    "UserInterface": {
    "AdvancedFilter": true,
    "List": true,
    "CreateOrUpdate": true
    }
    }
    ],
    "NavigationProperties": [],
    "NavigationPropertyOneToManyTables": [],
    "EnumDefinitions": [],
    "DbContext": null
    }

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @christianharo

    Thanks, yes, this is the one I'm takling about. We will check it.

  • User Avatar
    0
    musa.demir created

    Hi @christianharo
    It is fixed, it will be included to next rad tool release.
    Here is the solution
    image.png

  • User Avatar
    0
    christianharo created

    Thank you @musa.demir for the solution. Any idea when the new release of the tools will be in place ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @christianharo

    It is planned for 2020-12-17.

  • User Avatar
    0
    christianharo created

    Unfourtunately the error still exist in the new version. I am workin in the lates version now 10.2 however if there is a valitation error the button wont refresh shows saving and the ...

    image.png

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @christianharo,

    Thanks, we will check this.

  • User Avatar
    0
    musa.demir created

    Hi @christianharo

    Sory about that. It is fixed now, it will be included to next rad tool release.
    Until that, you can fix it manually:

    this._xxProxy.createOrEdit(this.xxEntity)
        .pipe(finalize(() => {//add that pipe
            this.saving = false;
        }))
        .subscribe((x) => {
            this.saving = false;
            this.notify.info(this.l('SavedSuccessfully'));
            this._router.navigate(['/app/main/xxNamespace/xxEntity']);
        });