473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Date in form

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <SCRIPT> var date = new Date(); var month = date.getMonth()+1; var day = date.getDate(); var year = date.getFullYear(); 
  5. var output= month + '/' +day + '/' + year; 
  6. function compareDate() 
  7. if(Date.parse(document.form1.Date.value)<Date.parse(output))
  8. alert("You cannot select a date less than the current date"); 
  9. </SCRIPT>  
  10. <link type="text/css" rel="stylesheet" href="ExternalStylesheet/homestylesheet.css" />
  11.  
  12. <style>
  13.  
  14. button{
  15. border:2px solid navy;
  16. background:white;
  17. height:40px;
  18. width:120px;
  19. border-radius:5px;
  20. background-color:navy;
  21. color:white;
  22. }
  23. h1{
  24. text-color:navy;
  25. padding-left:80px;
  26. text-align:center;
  27. }
  28. td{
  29. font-size:20px;
  30. width:400px;
  31. padding:5px;
  32. }
  33. form{
  34. border:5px solid red;
  35. }
  36. h1{
  37. color:#C71585;
  38. }
  39. table{
  40. margin-right:400px;
  41. margin-left:400px;
  42. }
  43. </style>
  44. </head>
  45. <body>
  46. <form name="form1">
  47. <h1> Register Online</h1>
  48. <Table>
  49. <tr>
  50. <td>First Name</td>
  51. <td><input type="text" name="usrname" PlaceHolder="Enter Your First Name" required></td>
  52. </tr>
  53. <tr> 
  54. <td> Last Name</td>
  55. <td><input type="text" id="usrname1" PlaceHolder="Enter Your Last Name" required></td>
  56. </tr>
  57. <tr>
  58. <td>Age</td>
  59. <td><input type="number" id="age" min="0" max="200" PlaceHolder="Enter Your Age"><td/>
  60. </tr>
  61. <tr>
  62. <td>Gender</td>
  63. <td><input type="checkbox" id="gender" value="Male">M<input type="checkbox" id="gender1" value="Female">F</td>
  64. </tr>
  65. <tr>
  66. <td>City</td>
  67. <td><input type="text" id="city" PlaceHolder="Enter your City" required</td>
  68. </tr>
  69. <tr>
  70. <td>State</td>
  71. <td><input type="text" id="state" PlaceHolder="Enter your state" required</td>
  72. </tr> 
  73. <tr>
  74. <td>Location</td>
  75. <td><input type="text" id="location" PlaceHolder="Enter your location" required</td>
  76. </tr>
  77. <tr> 
  78. <td> Email ID</td>
  79. <td><input type="email" id="mail" PlaceHolder="Enter Your email address" pattern="[^@]+@[a-zA-Z]+\.[a-zA-Z]{2,6}" required></td>
  80. </tr>
  81. <tr>
  82. <td>Preffered date</td>
  83. <td><input type="date" id="Date" PlaceHolder="Enter your preffered date" required</td>
  84. </tr>
  85. <tr>
  86. <td>Contact Number</td>
  87. <td><input type="num" id="number" PlaceHolder="Enter Your Contact Number" required></td>
  88. </tr>
  89. <tr>
  90. <td>Address</td>
  91. <td><textarea rows="4" cols="16" id="address" PlaceHolder="Enter your address" required>
  92. </textarea></td>
  93. </tr>
  94. <tr><td>
  95. <Button type="submit">Submit</BUTTON></td>
  96. <td><BUTTON type="reset">Reset</BUTTON>
  97. </td></tr>
  98. </table>
  99. </form>
  100.  
  101. </body>
  102. </html>
plz can anyone help...its still accepting the date less than the current date..i tried a lot..but in my eyes i found nothing wrong..plz guide me anyone...
Aug 7 '14 #1
1 1538
ok ok i got it..hehe..
i forgot the onchange attribute after the id attribute
Aug 7 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: wireless | last post by:
In our database is a decimal field with format YYMMDDhhmmss.9999999999 where the 9s are random digits. I'm trying to strip off just the YYMMDD and put it in date form. So far I came up with:...
1
by: s commar | last post by:
Hi I have a Platinum database which stores dates in integer form e.g the date is formatted as below: Column_name Type Length Precision...
4
by: Lisa Jones | last post by:
Hi Can someone tell me How do you get selected date form MonthCalendar control Thanks so muc Lisa
1
by: DawnAnne1974 | last post by:
I need to set a default date on a form that when it comes to a Monday, the form from and to dates will default to the Friday to Sunday of the previous week. For all other day, the form should...
2
by: Kun | last post by:
I have an html form that takes dates and inserts them into a mysql file. Currently, users have to type in dates in the yyyy-mm-dd format. As of now, this process works with the sql. However, I...
1
by: ranjit189 | last post by:
i got the date from oracle database using servlet programming string dt=x.getDatabaseValue("select sysdate from dual"); my problem is i got nother date i have entered now i want to compare both...
0
by: marianna | last post by:
hi everyone, i have aquestion with a programm of mine.I want to take a date from my database and when the query returns it it is like that:$row.So i guess it becomes a string or a variable. how can...
0
by: jgrob3 | last post by:
I have a form which contains two subforms: and . The two subforms each have a SQL query to display their results in datasheet view and allow the user to tick which items have been billed. ...
1
by: sravan_reddy001 | last post by:
how can get the date selected in the monthCalander Control i'm able to see the selectionstart property but its displaying the date and the start time (i.e) 12:00:00 AM i used the following code...
2
by: Sachin Karande | last post by:
select * from tbl_Task where Convert(datetime,Time,101)='2011/12/28' 2011/12/28 data is avalable in tbl_Task Table but i retrive data fro only date in datetime datatype Plz sove this query
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.