Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9237841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:37:34+00:00 2026-06-18T07:37:34+00:00

When you click edit in a grid that is not using a template then

  • 0

When you click edit in a grid that is not using a template then the validation rules that you defined for the schema.Model get applied correctly. But if you use a custom template the schema.Model validation rules do not get applied.

I suspect that the answer is that because I am using a custom popup edit template so that I can have a dropdown list, that I have to manually specify the rules for each html input field such as required. I so hope this is not true and that the same rules for defined the schema.Model will also work for an editor template.

Please post if you know the answer, Thanks!
Dan

@Daniel
Here is my code for getting the validation attributes defined in the model and adding them to the DOM

/**
 * Sets label,input html5 attributes and css based on the validation attributes of the
 * model for the given dataSource
 * @param {Object} myDs    dataSource that contains the Model Schema used for validation.
 */
function addValidationAttributes(myDs) {

    var myFields
    //Pass in DS or pass in model from grid
    if (myDs.options) {
        myFields = myDS.options.schema.model.fields
    } else//model
    {
        myFields = myDs.fields
    }

    $.each(myFields, function(fieldName) {
        //Add validation attributes
        if (this.validation) {
            $('#' + fieldName).attr(this.validation);
            //Set label to required if field is required
            if (this.validation.required) {
                $('label[for=' + fieldName + ']').addClass('required');
                $('#' + fieldName).attr('title', "required");
                //Check if KendoUI widget because it creates an extra span
                if ($('#' + fieldName).is('[data-role]')) {
                    $('.k-widget').after('<span class="k-invalid-msg" data-for="' + fieldName + '"></span>');
                } else {
                    $('#' + fieldName).after('<span class="k-invalid-msg" data-for="' + fieldName + '"></span>');
                }
            }
        } else//optional
        {
            //Non requried fields set to optional exclude KEY ID STAMP
            if (fieldName !== '__KEY' && fieldName !== '__STAMP' && fieldName !== 'ID') {
                //Check if KendoUI widget because it creates an extra span
                if ($('#' + fieldName).is('[data-role]')) {
                    $('.k-widget').after('<span class="optional" data-for="' + fieldName + '"></span>');
                } else {
                    $('#' + fieldName).after('<span class="optional" data-for="' + fieldName + '"></span>');
                }
            }
        }

    });
}

Also just in case you want it I set a class which adds an * before the label of a required field and a class the adds text “Optional” after each no required field. The KEY, ID, and STAMP are fields defined in my model but I don’t put them on a form, so you can exclude your entity key field or not if you want.

Here they are

.required:before {
    content: "*";
    color: red
}

.optional:after {
    content: " (optional)";
    color: #777;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:37:37+00:00Added an answer on June 18, 2026 at 7:37 am

    use required in your input elements

    <input type="text" class="k-input k-textbox" name="Name" data-bind="value:Name" required>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have editable grid view, If I click on edit in any row say
I am using Komodo Edit , a code editor. When I right click on
In in aspx page, there is a grid view, that has template control for
Hello, I'm developing a project using Ext Js that needs to edit a line
Is there a way to make a click-to-edit control in silverlight? I've got some
When I'm editing with files on the server, and I click to edit them,
for the moment the script does like this: click on the link edit the
The ajax feature is on route http://mysite/playlist-edit/3 Javascript: $(#applySort).click(function(){ var list = $(#sortable).sortable('toArray'); $.post({
$(#table_exams tbody tr).click(function (event) { window.location.href=# +$(this).attr(exam_ID); window.location.href=/medilab/prototypes/exams/edit?examId= + $(this).attr(exam_ID) +&referer= + referer; row_select(this);
I am having trouble getting the row of a WPF grid that a textbox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.