Field Validation HELP!

This is a discussion on "Field Validation HELP!" within the JavaScript Forum section. This forum, and the thread "Field Validation HELP! are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 9th, 2004, 04:00
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,603
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Field Validation HELP!

I am designing a room reservation in my college...
The rule of the booking is, it only allows booking at most one week ahead.

For example, let say today is 09/11/2004,
You can only book for a room from 09/11/2004 to 15/11/2004. That is a 1 week range. When you want to book at the 16/11/2004, the page will alert that you cannot make booking more than 1 week.The date format is dd/mm/yyyy.

How can I make the form in my asp page or a field in my form
to accept only the one week period of time from the date the booking is made when the form is submitted? Any idea....?

Please help me anybody.Please....
I have been searching out the code on how to do that, but I cannot understand how to code that!

Is there any popup callender picker that we can select only one week range from todays date? Could anybody help me please......
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

  #2 (permalink)  
Old Nov 9th, 2004, 16:24
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
why not have it as a select box so it only displays dates one week ahead?
  #3 (permalink)  
Old Nov 10th, 2004, 01:56
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,603
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Hai benbacardi!

I have thought of doing that, but I dont know how to do it!
Could you please help me benbacardi.

I am in a desperate situation here...
I dont know where else to find how to do it.
Please benbacardi....
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #4 (permalink)  
Old Nov 11th, 2004, 19:06
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
i dont know what the exact code would be but in psuedo code im sure its something like this:

Code: Select all
<select>
<option>Write todays date</option>
<option>Write todays date + 1</option>
<option>Write todays date + 2</option>
<option>Write todays date + 3</option>
<option>Write todays date + 4</option>
<option>Write todays date + 5</option>
<option>Write todays date + 6</option>
</select>
or something like that... im sure one of the more advanced programmers can help you!
  #5 (permalink)  
Old Nov 11th, 2004, 19:44
Anonymous User
Guest
Posts: n/a
see if this helps:

Code: Select all
<select>

<script language="javascript" type="text/javascript">
<!--

var date = new Date();
var d  = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;

thisdate = day;

for (i=0;i<7;i++) {

switch(month)
{
case 1,3,5,7,8,10:

if (thisdate > 30) {
thisdate = 1;
day = 1 - i;
month = month + 1;
}
else
{
thisdate = day + i;
}

break;
case 4,6,9,11:

if (thisdate > 29) {
thisdate = 1;
day = 1 - i;
month = month + 1;
}
else
{
thisdate = day + i;
}

break;
case 12:

if (thisdate > 30) {
thisdate = 1;
day = 1 - i;
month = 1;
year = year + 1;
}
else
{
thisdate = day + i;
}

break;
case 2:

if (thisdate > 27) {
thisdate = 1;
day = 1 - i;
month = month + 1;
}
else
{
thisdate = day + i;
}

break;
}

document.write("<option>" + thisdate + "/" + month + "/" + year + "</option>");

}

//-->
</script>

</select>
  #6 (permalink)  
Old Nov 11th, 2004, 19:46
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
^^ that was me
it had logged me out by itself....
Closed Thread

Tags
field, validation, help

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] playing with Perl Compatible Regex in field validation eon201 JavaScript Forum 33 Oct 26th, 2007 15:07
[SOLVED] Field validation and changing display properties... c_martini JavaScript Forum 12 Sep 25th, 2007 11:27
Need javascript to set input field value field jdadwilson JavaScript Forum 3 May 9th, 2007 04:47
Non-text field Validation NewDesigner JavaScript Forum 6 Nov 24th, 2006 22:34
Number validation in form field Matc JavaScript Forum 2 May 26th, 2006 15:05


All times are GMT. The time now is 11:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43