Announcement Announcement Module
No announcement yet.
client-side date validation with Commons is not working? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • client-side date validation with Commons is not working?

    hi, i am doing a spring web application. i have a form
    and it has a date field that requires MM/dd/yyyy format.
    the form has another required field called headline

    i defined a validator for the form controller and it is
    org.springframework.validation.commons.BeanValidat or.
    the validation.xml has the followinig:

    <form name="newsItem">
    <field property="headline" depends="required">
    <arg0 key="Headline"/>
    <field property="startDate" depends="date">
    <arg0 key="Start Date"/>

    i did configuration in each needed place. the Javascript for
    the headline field works, but there was no validation for
    the startDate field. i checked the html source and it has date validation

    function validateNewsItem(form){
    if (bCancel)
    return true;
    return validateRequired(form) && validateDate(form);

    function required () {
    this.aa = new Array("headline", "Headline is required.", new Function ("varName", " return this[varName];"));

    function DateValidations () {
    this.aa = new Array("startDate", "Start Date is not a date.", new Function ("varName", "this.datePattern='MM/dd/yyyy'; return this[varName];"));

    i spend some time but could not figure out why it failed.

    anybody out there has similar experience? or success experience?

    your help is really appreciated!

    thanks, pete

  • #2
    I'd give


    a try instead.


    • #3

      i tried "required,date". i was forced to put some input, but
      i was not stopped though i input something like "xsdfasdf".
      very i am wondering whether the sandbox
      is good to use.

      thanks, pete


      • #4
        Client side validation using commons validator

        Has anyone been able to find out why client side validations other than default "required" is not working in Commons Validator.
        As mentioned in above post, I am also facing the same issue, spent some time but found no solution. I also want to add my new custom validations by extending FieldChecks class. Server side validation works fine but client side fails. If someone already faced the issue and knows the answer, reply would be highly appreciated.
        Thanks in advance.
        Last edited by ranjeev; Dec 20th, 2007, 02:31 AM.


        • #5
          client-side date validation with Commons is not working?


          Could you please explain me or post ur applications on how we can go about doing the client side validations. I am trying to configure the client side validations but not very lucky though.