• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

have anyone got the solution?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I am having a html page with two date fields. The value of the second date field depends upon the value entered on the first date field.
For example if the users 11/12/2004 in the first date field(mm/dd/yyyy), the second date field should become 12/1/2004(mm/dd/yy).I wrote a method to be triggered on onblur method of the first date field. It works fine. I have the requirement that the second date field can be changed by the user also. Now if the user just focus and blur on the first date field the second date field gets changed. This should not happen. Only when there is a change in the value of the first date field,the second date field should be changed? How to handle this? Please any ideas..

Thanks In Advance
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set the field to readOnly and you really should do the calculation on the server since you can not rely on the data in the form.

Eric
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you should be using the onChange event instead of the onblur event.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Niki,

The onblur event is better than onchange since it will force a person to put in the correct info. If you use onchange, it does not force correct data.

Eric
 
Pandurangan Rakesh
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric

What you told is right..But i resorted to onchange event instead of onblur and doing the validations in client side..since as per the requirement server side validation is not allowed..

Thanks
Raghavendran.P
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pandurangan Rakesh:
the requirement server side validation is not allowed..



You better still be doing validation on the server side or you are asking for problems. I can get around any validation on the client and send you junk, so it has to be checked on the server.

Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic