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 8876741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:17:04+00:00 2026-06-14T19:17:04+00:00

I have a custom validator for a specific date control. The control renders three

  • 0

I have a custom validator for a specific date control. The control renders three dropdowns for day, month, and year.

The function works fine with Firefox, Chrome, and IE9/10. It fails on the iPad browser. I tried debugging using Adbode Edge Inspect but couldn’t debug the javascript.

Here is my code. Any suggestions?

$.validator.addMethod("validcustomdateday", function (value, element) {

    var elementName = $(element).attr("Id");
    var day = value.length === 1 ? "0" + value : value;
    var month = $("#" + elementName.substr(0, elementName.lastIndexOf("_")) + "_Month").val();
    month = month.length === 1 ? "0" + month : month;
    var year = $("#" + elementName.substr(0, elementName.lastIndexOf("_")) + "_Year").val();

    var dateStr = year + "-" + month + "-" + day;
    return !isNaN(Date.parse(dateStr));

});

Here are the rendered controls

<div class="control-group offset2 span6">
                <label class="control-label" for="Solicitors___0__DateOfBirth">Fecha de Nacimiento</label>
                <div class="controls">

<input id="Solicitors___0__DateOfBirth_DateOfBirth" name="Solicitors()[0].DateOfBirth.DateOfBirth" type="hidden" value="">
<select class="input-mini" data-bind="value: Solicitors()[0].DateOfBirth.Day" data-val="true" data-val-number="The field Dia must be a number." data-val-required="Debe especificar el Día" data-val-validcustomdateday="Se debe especificar una fecha válida" id="Solicitors___0__DateOfBirth_Day" name="Solicitors()[0].DateOfBirth.Day" placeholder="Dia"><option selected="selected">1</option>
<option>2</option>
<!-- Other days go here -->
<option>31</option>
</select>
<select class="input-small" data-bind="value: Solicitors()[0].DateOfBirth.Month" data-val="true" data-val-number="The field Mes must be a number." data-val-required="Debe especificar el Mes" id="Solicitors___0__DateOfBirth_Month" name="Solicitors()[0].DateOfBirth.Month"><option selected="selected" value="1">Enero</option>
<option value="2">Febrero</option>
<option value="3">Marzo</option>
<option value="4">Abril</option>
<option value="5">Mayo</option>
<option value="6">Junio</option>
<option value="7">Julio</option>
<option value="8">Agosto</option>
<option value="9">Septiembre</option>
<option value="10">Octubre</option>
<option value="11">Noviembre</option>
<option value="12">Diciembre</option>
</select>
<select class="span1" data-bind="value: Solicitors()[0].DateOfBirth.Year" data-val="true" data-val-number="The field Año must be a number." data-val-required="Debe especificar el Año" id="Solicitors___0__DateOfBirth_Year" name="Solicitors()[0].DateOfBirth.Year"><option value="1993">1993</option>
<option value="1992">1992</option>
<!-- Full Year List goes here -->
<option value="1937">1937</option>
</select>
<span class="help-inline field-validation-valid" data-valmsg-for="Solicitors()[0].DateOfBirth.Day" data-valmsg-replace="true"></span>
<span class="help-inline field-validation-valid" data-valmsg-for="Solicitors()[0].DateOfBirth.Month" data-valmsg-replace="true"></span>
<span class="help-inline field-validation-valid" data-valmsg-for="Solicitors()[0].DateOfBirth.Year" data-valmsg-replace="true"></span>
                    <span class="field-validation-valid help-inline" data-valmsg-for="Solicitors()[0].DateOfBirth" data-valmsg-replace="true"></span>
                </div>
            </div>
  • 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-14T19:17:06+00:00Added an answer on June 14, 2026 at 7:17 pm

    Fixed by changing Date.parse(“1993-01-01”) to Date.parse(“1993/01/01”). All safari browsers were failing to recognize the first string as a valid date

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom validator attached to a textbox control as follows <td align=center
I have a custom validator (located in app/validators/uri_validator.rb) which is used in: validates :link,
I have a custom validator that points to a Client side script to validate
I have a custom validator in a domain class that refers to a config
I have a custom password validator that someone gave me in an answer to
I’m having some problems with validation. I have created a custom validator called RequiredFieldRule
I have a minimum age custom validator which is straight forward enough: The constraint(Minage.php)
I have a model class that uses a custom validator as shown in following
I have a problem with Hibernate Validator 3.1.0.GA not looking up custom validation messages
I have custom validation rule: public function customRule($check) { } Inside this rule I

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.