serializeArray and problem

4 posts, 0 answers
  1. Gusev
    Gusev avatar
    74 posts
    Member since:
    Dec 2012

    Posted 01 Jul 2013 Link to this post

    Hello!
    I use serializeArray  for form.
    But this function doesn't return object, which have disabled fields
    I use:
    @(Html.Kendo().IntegerTextBoxFor(m => m)
          .Enable(false)
          .Spinners(false).....
    But if I use:
    @(Html.Kendo().IntegerTextBoxFor(m => m)...
    All good.
    Question: Need I get this(disaled) field by $(..[name="...]) or that I can do?
  2. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 03 Jul 2013 Link to this post

    Hello,

    The values of disabled inputs are not posted. If you wish the Users not to be able to edit the value but still post the value then you should make it readonly.

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Gusev
    Gusev avatar
    74 posts
    Member since:
    Dec 2012

    Posted 03 Jul 2013 Link to this post

    Hello!
    Thanks for help!
    But....
    I don't see in this @(Html.Kendo().NumericTextBoxFor(m => m) .......ReadOnly or Enable(ReadOnly)
    I don't want to use js to I could change to "read" options
    Why this option not included inside this wrapper?
  5. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 05 Jul 2013 Link to this post

    Hello,

    There isn't currently a configuration option that can be used to make the controls readonly. This should be done by calling the readonly method in JavaScript. From the code that you provided it seems that you can use something similar to the code in the snippet below:

    @model int
     
    @(Html.Kendo().IntegerTextBoxFor(m => m))
     
    <script>
        $(function () {
            var id = '@Html.ViewData.TemplateInfo.GetFullHtmlFieldId("")';
            var numeric = $("#" + id).data("kendoNumericTextBox");
            numeric.readonly();
        })
     
    </script>
    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
UI for ASP.NET MVC is VS 2017 Ready