• 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
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

comparing two time fields and validate using jquery error message

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

I have an issue where I want to compare two TIME fields and if StartTime is greater than EndTime, then it show error message, below StartTime field and form should be submitted if values are correct.

I have written a below function which is behaving correctly(I guess) & I am able to show alter message but could not get an idea to how to show jquery message.

Below is my query code:



Thanks in advance!

Regards
Gaurav
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gaurav Sharma wrote:I am able to show alter [sic] message but could not get an idea to how to show jquery [sic] message.



Well, there really isn't any such thing as a "jQuery message". How do you want the message to appear? You can certainly use jQuery to show the message; but how greatly depends on what you want to show and where you want to show it.
 
Gaurav Sharma
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear Sir,

Sorry for posting my code without formatting. I will keep this point in my mind.

Exact requirement is:
There are two fields - StartTime and EndTime.
If StartTime is greater than EndTime, then jquery error message should get displayed beneath StartTime field.

I am able to show error message for single field but don't know how to achieve it when I am comparing two fields.

Many Thanks
Gaurav
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gaurav Sharma wrote:then jquery [sic] error message should get displayed beneath StartTime field.


Again, there's no such thing as "jquery [sic] error message". If you want to show the message after the field, then you would use jQuery to create the HTML elements needed to show the text.

I am able to show error message for single field but don't know how to achieve it when I am comparing two fields.


I don't see the problem. You already know where you want to put the text. Just put it there. How does the fact that the condition compared two fields affect that?

By the way, I'd suggest using the jQuery Validation Plugin rather than rolling your own. It can automate much of this.
 
Your mother is a hamster and your father smells of tiny ads!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic