Repositioning the Kendo UI Validator

I've been attempting to adjust the placement of the Kendo UI Validator within my project, but modifying the properties in the related kendo CSS files (e.g. display: inline-block;) has not yet resolved the issue. So, how can I shift the position from below to the right of a control as illustrated in the attached diagram? Thank you in advance for your help.

Rendered HTML View:

<label for="Name">Name</label>

<span class="k-widget k-numerictextbox"><span class="k-numeric-wrap k-expand-padding k-state-disabled">
<input type="text" value="" name="Name" maxlength="30" id="Name" data-val-required="Required field" 
data-val-regex-pattern="^[a-zA-Z \.X]+$" data-val-regex="Please check the value" data-val-maxlength-max="25" 
data-val-maxlength="The field Name must be a string or array type with a maximum length of '25'." data-val="true" 
class="letters_onlyk-formatted-value k-input"></span><span data-valmsg-replace="true" data-valmsg-for="Name" 
class="field-validation-valid"></span></span>

<span class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error" data-for="Name" 
data-valmsg-for="Name" id="Name_validationMessage" role="alert"><span class="k-icon k-warning"> </span>Required field</span>


CSS Styles:

.k-widget.k-tooltip-validation {
    background-color: #FFF4C9;
    border-color: #FFE79E;
    color: #635145;
}

span.k-tooltip {
    border-width: 1px;
    display: inline-block;
    padding: 2px 5px 1px 6px;
    position: static;
}

.k-tooltip {
    background-repeat: repeat-x;
    border-style: solid;
    border-width: 1px;
    min-width: 20px;
    padding: 4px 5px 4px 6px;
    position: absolute;
    text-align: center;
    z-index: 12000;
}


Razor View:

@using (Html.BeginForm("Create", "Multiplier", FormMethod.Post,
new { id = "addForm", enctype = "multipart/form-data"}))
{
    @Html.AntiForgeryToken()

    <div class="container">
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })

        <fieldset>
            <legend>Person</legend>
            <section>
                <div class="legend-left">

                    @Html.ValidationMessageFor(model => model.Term)
                    <br />
                    @Html.LabelFor(m => m.Name)
                    @Html.Kendo().TextBoxFor(m => m.WhoIsOnline)
                    <br />
                    //... deleted for brevity
                </div>
            </section>
        </fieldset>  

            @(Html.Kendo().Button()
                .Name("submitbtn")
                .HtmlAttributes(new { type = "submit", @class = "k-primary k-button k-button-icontext" })
                .Content("Save")
            )
    </div>
}


Additional Info:

After implementing "@Html.ValidationMessageFor", the validation messages now appear as depicted below:

Answer №1

If you're looking to enhance your form validation, consider the placement of ValidationMessageFor after TextBoxFor. Your code structure should resemble the following:

@Html.LabelFor(m => m.Name)
@Html.Kendo().TextBoxFor(m => m.WhoIsOnline)
@Html.ValidationMessageFor(model => model.Term)

When styling with CSS, focus on color adjustments rather than changing positions or display attributes.

Remember to add the following script for validation functionality:

<script>
  $(document).ready(function() {
    $("form").kendoValidator()
  });
</script>

If a custom template is desired, utilize this script:

<script>
  $(document).ready(function() {
    $("form").kendoValidator(
    {
        errorTemplate: "<span class='required'>#=message#</span>"
    });
</script>

For more detailed guidance, visit: http://docs.telerik.com/kendo-ui/aspnet-mvc/validation

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Trigger elements in the navigation bar as the user navigates through different sections of my single-page website

I've been trying to implement this particular example on my website, but I seem to be struggling with it. Here are the lines that I added: <script src="jQuery/jquery-2.1.1.min.js" type="text/javascript"> </script> <script src="jQuery/ ...

Achieving and accessing multiple left panels in Jquery/CSS and automatically adjusting the main content container

Delving deeper into advanced CSS and JQuery for a unique layout, I've hit a roadblock. It seems like I might be overlooking something obvious or this could require more intricate scripting to achieve. Despite days of searching, I haven't come acr ...

Updating text color with Ajax response value

I need assistance with updating the text color of a sensor value displayed using html/ajax. Currently, the sensor value is being displayed successfully, but I want the text color to change based on the value. Here's an example: if value < 50 then f ...

Applying a class change in Vue.js upon mounting

How can I make a button element with a .hover property trigger the hover animation as soon as the page loads? I want to apply a class to the button when the page is mounted and then remove it later. What is the best approach for this? I considered using a ...

The issue of the color CSS rule not being applied to the button element when transitioning from disabled to enabled on browsers like Safari 14+ is a common challenge

There seems to be an issue with frontend form validation code affecting the disabled attribute of a submit button within a form. Two different css rules are applied for the enabled and disabled states, including changes in the text color of the button ele ...

Receiving a null response from an Ajax post request

I am facing an issue where a model object I am passing into a post Action in my web app contains null variables. The action looks like this: [HttpPost] [ValidateAntiForgeryHeader] public async Task<JsonResult> StartRound(RoundModel model) Here are ...

How to use multiple class names with Next.js module CSS

Currently, in my project I am utilizing Next.js along with module.css. However, I have encountered an issue. There is a "button" component nested inside another component. I am trying to apply both a normal className and Style.myClass to this button compon ...

Printing issues in Chrome cause table headers and footers to display incorrectly in tables with thead and t

Currently, I am utilizing puppeteer for generating PDFs on a Linux Alpine system. To achieve proper headers and footers on each page, I am employing the thead, tbody, tfoot trick. An anomaly caught my attention in how Chrome and Chromium handle layout whi ...

The Element should take up the entire page with the exception of a 20px margin

I am struggling to create an element that covers the entire page except for a 20px margin on all sides. I have tried implementing a solution using this code, which works in webkit browsers and Firefox but seems to have issues with Internet Explorer (10) an ...

The controller is failing to effectively showcase the ng-show functionality

My webpage consists of three elements: a search bar, a search result area, and a form. The use case scenario involves showing the search bar and form div by default, while hiding the search result div. When I enter keywords into the search bar, client data ...

How can the issue of the navbar color not being able to disappear or turn transparent be resolved, given its connection to the body color?

@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@400;500;600;700&display=swap'); :root { --color-body: #b6cbce; --color-heading: #eef3db; --color-base: #033f47; --color-base2: #022a30; --color-brand ...

Tips for creating a robustly typed partial view

Imagine I have a regular view (not strongly typed) and within this view, I include the following: <% Html.RenderPartial("ViewUserControl1") %> However, this Partial View is strongly typed with a class (let's say class1). How can I pass data ...

Following the deployment of an Angular 6 Application on IIS, I am encountering a blank page without any accompanying error messages

I recently deployed an Angular 6 Application with asp.net mvc on IIS and am facing the issue of getting a blank page. The only thing showing up is the title inside the <head> in the html, but none of the contents - specifically the angular 6 compone ...

What is the best method for overlaying text on individual images in a slideshow?

Currently, I am delving into the world of jQuery, experimenting with various slideshows and attempting to incorporate text and effects. In my endeavors, I stumbled upon this codepen that served as an excellent template. However, when I tried adding text o ...

Create a full bottom shadow for a circular shape using CSS 3

Hey there, I'm having an issue with creating a separation effect for a circle. I've been using the box-shadow property like this: box-shadow: 0 1px 0 rgba(0,0,0,.2);. However, as you can see in the image, the shadow on the left and right sides is ...

help with coding in html and css

Hey there, I’m currently working on creating a loading page for my website, but I seem to be facing an issue with a white line appearing along the top and one running down the left side. If anyone could provide me with some assistance on this matter, I ...

The list-image is nowhere to be found

Seeking assistance with my LI style CSS. Visit this link for reference I'm having trouble getting an image to float on the right side of my sidebar links, and my content is overlapping with the sidebar... .sidebar-menu ul { font : 14px font-fam ...

Adjust the position of the icon in the Mui DatePicker widget

How can I customize the mui DatePicker? I successfully changed the icon, but now I need to adjust its position as well. Instead of being at the end of the text, I want the icon to be at the beginning. Here is my code: <ThemeProvider theme={calendarThem ...

Can uniform columns be created in separate HTML elements?

Looking to create a uniform list in HTML, where the columns inside each panel line up perfectly. See the desired layout: https://i.sstatic.net/FbbPu.png In this example, Col_1 has a width of "BBBBB", as it is the widest content in that column, ...

How can I combine an ordinary image and a CSS2D image in THREE.js CSS2DRenderer and save them together as a single .jpg file?

After implementing the following code... (1) I successfully saved regular rendered THREE.js scenes as .jpg files; (2) Additionally, I managed to utilize CSS2DRenderer to display CSS2D labels on top of the canvas; (3) Now, my goal is to save the image wi ...