Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Javascript Date Validation

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
JJenson Posted - 11 November 2008 : 11:54:49
Just wondering if anyone has some javascript code or know where I might find some that will do the following:

Let someone select a date today or in the past but will not allow them to pick any future dates?

I need this for a feedback form and we need to let them put what day into the field but obviously they can't visit int he future and be giving feedback today

Any help would be great I just can't seem to find how to do this variation.<
6   L A T E S T    R E P L I E S    (Newest First)
Carefree Posted - 11 November 2008 : 19:49:23
Why not simply use DateSerial? Convert (today) and the (input date) into "yyyymmdd" format, then use a comparison.


if DateSerial("strinput") > DateSerial("strtoday") then 
	'do nothing, date is in the future
else
	'do whatever it is you wanted done
end if
<
AnonJr Posted - 11 November 2008 : 17:06:18
Check over at http://www.codeproject.com/ - I seem to remember seeing a few there. Its been a while since I was last there as they were getting more .NET projects than anything else for a while. Its not that I have a thing against .NET, its just not what I'm doing right now.<
JJenson Posted - 11 November 2008 : 16:30:16
Yeah I know what you are saying but they are paying me for the JS and don't want to spend any other money. This is a customer that I am not going to just go ahead and do extra for them. But I have defiantly told them to do both but oh well.

Yeah I will keep looking.<
AnonJr Posted - 11 November 2008 : 16:08:51
If that's what they ask for, then that's what they ask for. However, it would be prudent to point out the number of people using extensions like NoScript. Not knowing about your client, I also wonder if they really understand or just know that "JavaScript" is one of those things they are supposed to ask for...

As for how to go about doing it, I seem to remember seeing a couple of validation frameworks out there that would simplify things. Its been so long since I last bothered with JS validation I don't recall the names off the top of my head. These days I just do all validation server side. It simplified my testing headaches.<
JJenson Posted - 11 November 2008 : 13:53:29
Well the client only wants me to do the Javascript so thats all I am doing but I told them it wouldn't be 100% but they still only want javascript.<
AnonJr Posted - 11 November 2008 : 13:06:22
Have you set up any server-side validation? I ask only because you're still going to want to do that even if you do get the JS working.

All things being equal, I would work on the server validation first, and then add in the JS next. I say that only because its the only way to be sure you get what you want. Some people turn JS off, others may not have the most current browsers (I still have a small number of people that visit the Jesus Joshua site using IE5.5...).<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000 Version 3.4.07