Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 24th, 2005, 07:34 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help Needed

I want date valadations in YYMM format and the user this value in textbox

thanks in advance.

Reply With Quote
  #2 (permalink)  
Old August 24th, 2005, 09:31 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Raj!!

Hope this will help you
<script>
function getVal(obj)
{
strval=obj.value
regexp=/^(\d){4}$/;
if(regexp.test(strval))
{
 years=strval.substring(0,2)
 months=strval.substring(2,4)

  if(years=="00"||months=="00")
    {alert("eerorr in month years can't be 0")
     return false;
     }


  if(parseInt(months)>12)

  {alert("month can't be greater than 12")
       return false;
       }


 return true;
}
else
{
alert("errr YYMM format")
}

}
function getDateFormat(obj1)
{
if(!getVal(obj1))
 {
 document.myform.dt.select();
 document.myform.dt.focus();
 }
else
{
 alert("success")
 }
}
</script>
<form name=myform>

<input type=text name=dt onblur="getDateFormat(this)">
</form>

Cheers :)

vinod
Reply With Quote
  #3 (permalink)  
Old August 25th, 2005, 04:54 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi ,

Thanks a lot for your information and i also need extra valadation
This is the Requirement.
Date entered should not be greater than (current date + 1 month). Suppose if the user is entering fiscal date on ’0507’, the fiscal date should not be greater than ‘0508’.

Thanks in advance,

Special thanks to vinod..

Reply With Quote
  #4 (permalink)  
Old August 25th, 2005, 05:52 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

HI Raj !!

If this is the case then you need to store current month/year in hidden variables.
and compare that values in ur function.Why i m giving the idea to store it in hidden text fields is that ,if you rely on client side javascript date ,then the user can change the date setting of his own PC.
So ,now you have hidden cmonth and cyear ,now compare these two with the values entered by the client.
Hope this will help you



Cheers :)

vinod
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed ramabharti Javascript How-To 1 December 7th, 2006 06:42 AM
Help needed rrvinod ADO.NET 0 October 5th, 2006 09:44 AM
help needed! paquito Beginning PHP 2 November 16th, 2005 11:51 AM
A Little help needed matthew01 ASP.NET 1.0 and 1.1 Basics 3 November 9th, 2005 11:29 AM
help needed kfarooq Java Databases 1 June 27th, 2003 05:20 AM



All times are GMT -4. The time now is 05:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.