[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

Need JavaScrpt Code Sample to Validate Form Date Field

Asked by pzozulka in JavaScript, Asynchronous Javascript and XML (AJAX), PHP Scripting Language

Tags: PHP, JavaScript

Greetings,

I have a web form that is emailed to us once it is filled out. It also has a date field, that needs to be validated somehow to not allow input of any days within 3 days from now. So the min. date field acceptable should be 10/06/08 (3 days from now). I was pointed to a great link below, but unfortunately I have no experience with AJAX or JavaScript for that matter. So I have no idea how to implement this. I downloaded the AJAX library with all the .js files, and uploaded them to my server. The only problem is to implement it. The web form code is posted below. If anyone can provide a code sample to implement this that would be great.

Any other ways (code samples) to validate my date field are also welcome.

http://www.frequency-decoder.com/2006/10/02/unobtrusive-date-picker-widgit-update/
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:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
<!DOCTYPE html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Contact domain Court Reporters</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<SCRIPT language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
 
}
//-->
</SCRIPT>
<STYLE type="text/css">
<!--
 
.style4 {font-family: Arial, Helvetica, sans-serif}
 
a:link {
 
        color: #FFFFFF;
 
}
 
a:visited {
 
        color: #FFFFFF;
 
}
.style7 {color: #000000}
.style9 {
	color: #FFFFFF;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 16px;
}
.style13 {font-size: 26px}
.style14 {
	color: #999999;
	font-size: 14;
	font-style: italic;
}
.style15 {font-size: 10px}
 
-->
</STYLE>
 
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style17 {color: #CC3333}
-->
</style>
</HEAD>
 
<BODY bgcolor="3e5368" text="#FFFFFF">
        <table width="756" border="0">
  <tr>
    <td width="292"><img src="../images/logo.gif" width="149" height="56"></td>
    <td width="454"></td>
  </tr>
</table>
 
 
        <table width="955" height="844" border="0" cellpadding="10">
          <tr>
            <td width="183" valign="top"><p><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><a href="../">www.domain.com</a></font></p>
                <table width="170" border="1" bordercolor="#DBD9CD" bgcolor="#DBD9CD">
                  <tr>
                    <td width="130" bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="client_home.html">Home</a></span> </td>
                  </tr>
                  <tr>
                    <td bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="services.html">Services</a></span> </td>
                  </tr>
                  <tr>
                    <td bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="support.html">Support</a></span> </td>
                  </tr>
                  <tr>
                    <td bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="training.html">Training</a></span> </td>
                  </tr>
                  <tr>
                    <td bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="contact.html">Contact</a></span> </td>
                  </tr>
                  <tr>
                    <td bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="../repository">On-Site Repository</a></span> </td>
                  </tr>
                  <tr>
                    <td bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="http://www.domaintt.com">Trial Technology </a></span> </td>
                  </tr>
                  <tr>
                    <td bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="https://web.domain.com/attorney/">domainWeb<font face="Symbol">&#0153;</font> </a></span> </td>
                  </tr>
                  <tr>
                    <td bordercolor="#878884" bgcolor="#8AABC9"><span class="style4"><a href="http://www.webdocument.net/domainreporting">domainE-Repository<font face="Symbol">&#0153;</font> </a></span></td>
                  </tr>
                </table>
              <p>&nbsp;</p></td>
            <td height="324" align="center">
            
            <p class="style9"><span class="style13">Schedule a Deposition</span></p>
            <p class="style9"><a href="../web/attorney.htm">Already have a <strong>domainWeb&#8482;</strong> account?</a></p>
            <p class="style9">OR</p>
            <p class="style9">Fill out the form below:</p>
            <table width="813" height="1094" border="0" align="center" background="../Images/sheduledepo1100.gif">
              <tr>
                <td width="807" height="1090" align="left" valign="top"><table width="804" height="1031" border="0">
                  <tr>
                    <td height="974" colspan="2" valign="top">
                    
                    <form action="scheduleform-process.php" method="post">
                      <p align="center">&nbsp;</p>
                      <table width="764" height="926" border="0" align="center" cellpadding="1">
                        <tr>
                          <td width="249"><span class="style9">Request Type:</span></td>
                          <td width="497"><span class="style9">
                      <select name="RqstType" size="1" class="style7" id="RqstType">
                              <option selected>New</option>
                              <option>Change</option>
                              <option>Cancellation</option>
                              <option>Confirmation</option>
                          </select>
                          </span></td>
                        </tr>
                        <tr>
                          <td class="style9">Deposition Date:</td>
                          <td><span id="sprytextfield1">
                          <input name="JobDate" type="text" class="style7" id="JobDate" size="40">
                          <span class="textfieldRequiredMsg"></span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span> (mm/dd/yyyy) </td>
                        </tr>
                        <tr>
                          <td class="style9">&nbsp;</td>
                          <td><span class="style17">Deposition date must be at least 3 days from today.</span></td>
                        </tr>
                        <tr>
                          <td class="style9">Time Zone:</td>
                          <td><span class="style9">
                            <select name="TimeZone" size="1" class="style7" id="TimeZone">
                              <option selected>Pacific Time (PST)</option>
                              <option>Mountain Time (MST)</option>
                              <option>Central Time (CST)</option>
                              <option>Eastern Time (EST)</option>
                            </select>
                          </span></td>
                        </tr>
                        <tr>
                          <td class="style9">Deposition Time:</td>
                          <td><span class="style9">
Start Time:
    <span id="sprytextfield7">
    <input name="StartTime" type="text" class="style7" id="StartTime" size="21">
    <span class="textfieldRequiredMsg"></span></span>
End Time:
<input name="EndTime" type="text" class="style7" id="EndTime" size="21">
                          </span></td>
                        </tr>
                        <tr>
                          <td class="style9">Ordered By:</td>
                          <td valign="middle" class="style9">First Name:
                            <span id="sprytextfield5">
                            <input name="OrderedByFirstName" type="text" class="style7" id="OrderedByFirstName">
                            <span class="textfieldRequiredMsg"></span>                            </span> 
                            Last Name: 
                            <span id="sprytextfield6">
                            <input name="OrderedByLastName" type="text" class="style7" id="OrderedByLastName">
                            <span class="textfieldRequiredMsg"></span></span></td>
                        </tr>
                        <tr>
                          <td class="style9">Attorney:</td>
                          <td valign="middle" class="style9">First Name:
                            <input name="ContactFirstName" type="text" class="style7" id="ContactFirstName"> 
                          Last Name: 
                          <input name="ContactLastName" type="text" class="style7" id="ContactLastName">                          </td>
                        </tr>
                        <tr>
                          <td class="style9">Phone: </td>
                          <td valign="middle"><input name="ContactPhone" type="text" class="style7" id="ContactPhone" size="66"></td>
                        </tr>
                        <tr>
                          <td class="style9">Mobile: <span class="style15">(Required for after-hour depositions)</span></td>
                          <td valign="middle"><input name="ContactMobile" type="text" class="style7" id="ContactMobile" size="66"></td>
                        </tr>
                        <tr>
                          <td class="style9">Fax Number: <span class="style15">(to send confirmation)</span></td>
                          <td valign="middle"><span id="sprytextfield8">
                          <input name="ContactFax" type="text" class="style7" id="ContactFax" size="66">
                          <span class="textfieldRequiredMsg"></span></span></td>
                        </tr>
                        <tr>
                          <td class="style9">E-mail: <span class="style15">(to send confirmation)</span></td>
                          <td valign="middle"><span id="sprytextfield2">
                          <input name="ContactEmail" type="text" class="style7" id="ContactEmail" size="50">
                          <span class="textfieldRequiredMsg"></span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
                        </tr>
                        <tr>
                          <td class="style9">Firm Name:</td>
                          <td valign="middle"><span id="sprytextfield9">
                            <input name="FirmName" type="text" class="style7" id="FirmName" size="66">
                          <span class="textfieldRequiredMsg"></span></span></td>
                        </tr>
                        <tr>
                          <td><span class="style9">Deposition Location:</span></td>
                          <td><table width="426" border="0">
                            <tr>
                              <td width="161"><span class="style9">Location Name: </span></td>
                              <td width="255"><span id="sprytextfield10">
                                <input name="LocName" type="text" class="style7" id="LocName" size="40">
                              <span class="textfieldRequiredMsg"></span></span></td>
                            </tr>
                            <tr>
                              <td><span class="style9">Address:</span></td>
                              <td><span class="style9">
                                <input name="LocAddress" type="text" class="style7" id="LocAddress" size="40">
                              </span></td>
                            </tr>
                            <tr>
                              <td><span class="style9">City:</span></td>
                              <td><span class="style9">
                                <input name="LocCity" type="text" class="style7" id="LocCity" size="40">
                              </span></td>
                            </tr>
                            <tr>
                              <td><span class="style9">State: </span></td>
                              <td><span class="style9">
                                <input name="LocState" type="text" class="style7" id="LocState" size="40">
                              </span></td>
                            </tr>
                            <tr>
                              <td class="style9">Zip:</td>
                              <td><input name="LocPostCode" type="text" class="style7" id="LocPostCode" size="40"></td>
                            </tr>
                            <tr>
                              <td class="style9">Phone:</td>
                              <td><input name="LocPhone" type="text" class="style7" id="LocPhone" size="40"></td>
                            </tr>
                          </table></td>
                        </tr>
                        <tr>
                          <td><span class="style9">Deponent 1:</span></td>
                          <td><span id="sprytextfield11">
                            <input name="Witness1" type="text" class="style7" id="Witness1" size="66">
                          <span class="textfieldRequiredMsg"></span></span></td>
                        </tr>
                        <tr>
                          <td><span class="style9">Deponent 2:</span></td>
                          <td><input name="Witness2" type="text" class="style7" id="Witness2" size="66"></td>
                        </tr>
                        <tr>
                          <td><span class="style9">Deponent 3:</span></td>
                          <td><input name="Witness3" type="text" class="style7" id="Witness3" size="66"></td>
                        </tr>
                        <tr>
                          <td class="style9">Expert Type:</td>
                          <td><span class="style9">
                            <select name="ExpertType" size="1" class="style7" id="ExpertType">
                              <option selected>Not an expert witness</option>
                              <option>Accident &amp; Injury</option>
                              <option>Business &amp; Financial</option>
                              <option>Civil Litigation</option>
                              <option>Construction &amp; Architecture</option>
                              <option>Criminal Litigation</option>
                              <option>Medical &amp; Psychological</option>
                              <option>Patent Infringement</option>
                              <option>Science &amp; Engineering</option>
                            </select>
                          </span></td>
                        </tr>
                        <tr>
                          <td><span class="style9">Case Name:</span></td>
                          <td><span id="sprytextfield12">
                            <input name="CaseName" type="text" class="style7" id="CaseName" size="66">
                          <span class="textfieldRequiredMsg"></span></span></td>
                        </tr>
                        <tr>
                          <td align="left"><span class="style9">Case #:</span></td>
                          <td><input name="CauseNo" type="text" class="style7" id="CauseNo" size="66"></td>
                        </tr>
                        <tr>
                          <td class="style9">Additional Services:</td>
                          <td><table width="426" border="0">
                            <tr>
                              <td class="style9"><input name="Video" type="checkbox" class="style9" id="Video" value="Video Checked"> 
                                Video 
                                <input name="Interpreter" type="checkbox" id="Interpreter" value="Interpreter Checked">
                                Interpreter<span class="style14">, 
                                <span id="sprytextfield4">
                                <input name="Language" type="text" class="style14" id="Language" size="25">
                              </span>                              </span></td>
                            </tr>
                            <tr>
                              <td class="style9"> <input name="GreenCopy" type="checkbox" id="GreenCopy" value="GreenCopy Checked">
                              GreenCopy&#8482; PDF* ($40 Discount)</td>
                            </tr>
                            <tr>
                              <td class="style9"><input name="RealTime" type="checkbox" class="style9" id="RealTime" value="Real-Time Checked"> 
                                Interactive Real-time</td>
                            </tr>
                            <tr>
                              <td class="style9"><input name="Expedite" type="checkbox" class="style9" id="Expedite" value="Expedite Checked">
                              Expedite/Trial Date<span id="sprytextfield3">
                              <input name="TrialDate" type="text" class="style14" id="TrialDate" size="26">
                              </span></td>
                            </tr>
                          </table></td>
                        </tr>
                        <tr>
                          <td class="style9">Sign up for <strong>domainWeb&#8482;</strong>?</td>
                          <td valign="top"><label>
                            <input type="radio" name="domainWeb" value="Yes" id="domainWeb_0">
Yes</label>
                            <input type="radio" name="domainWeb" value="No" id="domainWeb_1">
                            <label>No</label></td>
                        </tr>
                        <tr>
                          <td height="77"><input name="ScheduledDate" type="hidden" id="ScheduledDate" value="<?php echo date("Y-m-j H:i:s");?>"></td>
                          <td><input name="submit" type="submit" class="style7" id="submit" value="Submit">
                          <input name="reset" type="reset" class="style7" id="reset" value="Reset"></td>
                        </tr>
                      </table>
                    </form>                    </td>
                  </tr>
                  <tr>
                    <td width="765" height="51" valign="top"><div align="center"><img src="../Images/sheduledepotree.gif" width="343" height="36" border="0" usemap="#Map"></div></td>
                    <td width="29" valign="top">&nbsp;</td>
                  </tr>
                </table>                
                </td>
              </tr>
              </table>
            </td>
          </tr>
            </table>
          <P><FONT color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">&copy; 2008 
  domain Court Reporters</FONT></P>
       
<map name="Map"><area shape="rect" coords="2,3,364,45" href="../PDF Files/domainEarthSmallPC08.pdf" target="_blank">
</map><script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "date", {format:"mm/dd/yyyy"});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {isRequired:false, hint:"Trial Date"});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {isRequired:false, hint:"Language"});
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "none");
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7");
var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "none");
var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9");
var sprytextfield10 = new Spry.Widget.ValidationTextField("sprytextfield10");
var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11");
var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12");
//-->
</script></BODY>
 
</HTML>
[+][-]10/03/08 11:34 AM, ID: 22636688Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: JavaScript, Asynchronous Javascript and XML (AJAX), PHP Scripting Language
Tags: PHP, JavaScript
Sign Up Now!
Solution Provided By: deresh
Participating Experts: 1
Solution Grade: A
 
[+][-]10/03/08 05:58 PM, ID: 22639047Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/06/08 09:07 AM, ID: 22651529Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/06/08 09:12 AM, ID: 22651599Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/06/08 12:07 PM, ID: 22653268Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/06/08 01:28 PM, ID: 22654129Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628