Need More Info
Last Updated: 25 Dec 2024 15:48 by ADMIN
Philip
Created on: 17 Dec 2024 21:50
Category: UI for ASP.NET MVC
Type: Feature Request
0
Add a Password field

In many applications we use passwords. Would love to have a field that allows for the setting of a type to "password" without templates. 

.PasswordTextField() or something similar. 

3 comments
ADMIN
Eyup
Posted on: 25 Dec 2024 15:48

Hi Philip,

 

Yeah, the .cs model annotation attribute is the most straightforward approach and I am glad it will work for you.

Nevertheless, I will keep the feedback item open for now so others customers can check it and vote for it.

Thank you for sharing this cool idea!

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Philip
Posted on: 18 Dec 2024 16:49

Hi Eyup,

Thanks for the response. I don't know if I would ever use the password outside the context of a form, so your syntax here wouldn't help me:

 @(Html.Kendo().TextBox()
          .Name("textbox")
          .HtmlAttributes(new {type="password"})
          .Value("test")
 )

If I do that same syntax above within a form, it doesn't work.

items.Add()
.Field(f => f.Password)
.Label(l => l.Text("Password:"))
.Editor(field => field.TextBox().HtmlAttributes(new { type = "password " }))



That being said, I had read that validation page and hadn't thought to check the .cs model file to see if that respected the result. 

Thank you!

ADMIN
Eyup
Posted on: 18 Dec 2024 13:03

Hello Philip,

 

Thank you for writing to us.

Yes, the Password type is a common requirement for a lot of applications. The .NET framework provides its built-in Data Annotation Attribute to help with this:

        [Required]
        [Display(Name = "Choose Password:")]
        [DataType(DataType.Password)]
        public string Password
        {
            get;
            set;
        }
And our components are designed with these Model attributes in mind:
https://demos.telerik.com/aspnet-core/form/validation

And also, it is possible to define the textbox component as a password field directly from the server:

        @(Html.Kendo().TextBox()
            .Name("textbox")
            .HtmlAttributes(new {type="password"})
            .Value("test")
        )
I have prepared a live sample for demonstration:
https://netcorerepl.telerik.com/GebQFMld02hE09FM02

Do you find these options beneficial for your projects?

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.