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

  • SEARCH
  • Home
  • 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 8984575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:08:23+00:00 2026-06-15T21:08:23+00:00

I have a view page where i’m validating fields using knockout.js . I want

  • 0

I have a view page where i’m validating fields using knockout.js . I want to validate my fields in different country’s language like spanish,french etc i.e using localization.
I have added el-GR.js ,fr-FR.js , ru-RU.js etc files into my js folder and referenced them.
Now how can i validate or check into my modalModal.js page?

modalModal.js

    ko.validation.rules.pattern.message = 'Invalid.';
    ko.validation.configure({
    registerExtenders : true,
    messagesOnModified : true,
    insertMessages : true,
    parseInputAttributes : true,
    messageTemplate : null
    });

   var mustEqual = function (val, other) {
   return val == other();
   };

   var modalViewModel= {
   firstName : ko.observable().extend({
    minLength : 2,
    maxLength : 40
    }),
    lastName : ko.observable().extend({
    minLength : 2,
    maxLength : 10
    }),
    organisation : ko.observable().extend({
    minLength : 2,
    maxLength : 40
    }),

    email : ko.observable().extend({ // custom message
    email: true
    }),
    password: ko.observable()
    };

    modalViewModel.confirmPassword = ko.observable().extend({
    validation: { validator: mustEqual, message: 'Passwords do not match.', params: 
    modalViewModel.password }
    });
   modalViewModel.errors = ko.validation.group(modalViewModel);

  // Activates knockout.js
   ko.applyBindings(modalViewModel,document.getElementById('light'));
  • 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-15T21:08:24+00:00Added an answer on June 15, 2026 at 9:08 pm

    I’ve done this for my latest KO project

    I override the KO validation rules and use the Globalize plugin, like

    ko.validation.rules.number.validator = function (value, validate) {
        return !String.hasValue(value) || (validate && !isNaN(Globalize.parseFloat(value)));
    };
    
    ko.validation.rules.date.validator = function (value, validate) {
        return !String.hasValue(value) || (validate && Globalize.parseDate(value) != null);
    };
    

    edit: btw, there is a bug in the Globalize plugin, it will accept dot (.) as part of a number even if it isn’t, i fixed that like this

    Globalize.orgParaseFloat = Globalize.parseFloat;
    Globalize.parseFloat = function (value) {
        value = String(value);
    
        var culture = this.findClosestCulture();
        var seperatorFound = false;
        for (var i in culture.numberFormat) {
            if (culture.numberFormat[i] == ".") {
                seperatorFound = true;
                break;
            }
        }
    
        if (!seperatorFound) {
            value = value.replace(".", "NaN");
        }
    
        return this.orgParaseFloat(value);
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created view page in MVC like <%using (Html.BeginForm()) { %> <%=LabelHelpers.Label(firstname, FirstName:)%>
I have two form fields on my view page, a date input (with a
I have a grid view on my page and I want to export it
I want to display particular block on view page. I have added list to
Hello I have asp mvc view page, <%@ Page Language=C# Inherits=System.Web.Mvc.ViewPage<System.Drawing.Color[,]> %> how I
I have a view and I want to use a layout page. In the
I have a view that I am using for articles on the front page
I have view page with both detailview and gridview the grid view should be
I have a view page that accepts a taxonomy term id as an argument
I have a view page in Yii. It is cached with page cache. Now,

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.