kendo form item editor.placeholder displays but not when editor.value is used

1 Answer 20 Views
Editor Form
Paul
Top achievements
Rank 1
Paul asked on 02 Apr 2025, 11:08 PM

 i.Add()
 .Id(Id.ToString())
 .Name(Id.ToString())
 .Title(Name.ToString())
 .Field(Id.ToString())
 .Label(l => l.Text(Lab + ":"))
 .Editor(e =>
 {
     e.NumericTextBox<Decimal>()
         .Format("c")
         .Value(System.Convert.ToDecimal(Answer));
 });

Posted above is an item on a form unfortunately the Value property doesn't display anything nor does hard coding a number into Value property. However, when I place the same variable into the placeholder property, it does seem to display what its supposed to. Is there a reported bug for why this is happening or perhaps a work around to assist this. 

Thank you in advance for your assistance

1 Answer, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 05 Apr 2025, 09:03 AM

Hi Paul,

 

Thank you for writing to us.

The built-in NumericTextBox Editor within the Form component gets its Value automatically:

                i.Add()
                    .Field(f => f.Answer)
                    .Label(l => l.Text("Answer:"))
                    .Editor(e =>
                    {
                       e.NumericTextBox<Decimal>()
                       .Format("c");
                    })
I have created a live example for your convenience:
https://netcorerepl.telerik.com/GzYoEzOX01jPniHk02

If you want to have a custom value and configuration, you can use a Template Editor:
https://demos.telerik.com/aspnet-core/form

Similar to this:

                    i.Add()
                        .Field(f => f.Password)
                        .Label(l => l.Text("Password:"))
                        .Hint("Hint: enter alphanumeric characters only.")
                        .EditorTemplateHandler("setPasswordEditor");
JS:
    function setPasswordEditor(container, options) {
        $('<input type="password" id="Password" name="' + options.field + '" title="Password" required="required" autocomplete="off" aria-labelledby="Password-form-label" data-bind="value: Password" aria-describedby="Password-form-hint"/>')
            .appendTo(container)
            .kendoTextBox();
    }
Was this answer informative? Let me know how I can help you further.

 

Regards,
Eyup
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Tags
Editor Form
Asked by
Paul
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or