PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/ __________________________________________________________________
Tim Thanks very much, this did the trick. For a non-JavaScript, expert, you seem to know your way around JavaScript pretty well. This is the second time you've helped me, you got me started on a "required fields" script earlier in the summer. I really appreciate the help. Any advice re: learning JavaScript by someone who does not have a background in programming? Books or suggested course of study? Kenn ----- Original Message ----- From: "Day, Tim G." <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 11, 2003 7:31 AM Subject: RE: [PDF-Forms] Day of Week Calculation in a PDF Form > > PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/ > __________________________________________________________________ > > KC, > > Try this routine (Disclaimer: I'm not a JavaScript expert, so this routine > could probably be improved, but I think it at least works.): > > var cDay; > var cMonth; > if (event.value != "") > { > var d1= AFParseDateEx(event.value, "m/d/yyyy"); > switch (d1.getDay().toString()) > { > case "0" : > cDay = "Sunday" > break; > case "1" : > cDay = "Monday" > break; > case "2" : > cDay = "Tuesday" > break; > case "3" : > cDay = "Wednesday" > break; > case "4" : > cDay = "Thursday" > break; > case "5" : > cDay = "Friday" > break; > case "6" : > cDay = "Saturday" > break; > } > switch (d1.getMonth().toString()) > { > case "0" : > cMonth = "January" > break; > case "1" : > cMonth = "February" > break; > case "2" : > cMonth = "March" > break; > case "3" : > cMonth = "April" > break; > case "4" : > cMonth = "May" > break; > case "5" : > cMonth = "June" > break; > case "6" : > cMonth = "July" > break; > case "7" : > cMonth = "August" > break; > case "8" : > cMonth = "September" > break; > case "9" : > cMonth = "October" > break; > case "10" : > cMonth = "November" > break; > case "11" : > cMonth = "December" > break; > } > > var cDate = String(d1).substring (8,10); > // If the first character of the day's date is "0", such as "09" > if (cDate.substring(0,1) == "0") > // Remove the leading zero. > cDate = String(d1).substring (9,10); > event.value = cDay + ", " + cMonth + " " + cDate + ", " + > String(d1).substring (52,57) > } > > Tim Day > CDC > > -----Original Message----- > From: kc [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 10, 2003 6:12 PM > To: [EMAIL PROTECTED] > Subject: [PDF-Forms] Day of Week Calculation in a PDF Form > > > PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/ > __________________________________________________________________ > > Hello All > > I have been told (sort of) on another forum that it may be possible to have > a PDF field indicate the day of the week, once the user fills in the date. > > My objective is to have a field that calculates the day of the week for a > particular date, then adds the day in front of the date. > > For example: a user goes to the date field and types in 1/1/2006. When they > go on to the next field, the date field figures out that 1/1/2006 is a > Sunday, and changes the data displayed in the date field to Sunday, January > 1, 2006. > > Has anyone accomplished this, or can you recommend a reference that might > have this information in it? I have 3 books about extending PDF forms with > Javascript, but none address something like this. > > Thanks in advance for your ideas > > > To change your subscription: > http://www.pdfzone.com/discussions/lists-pdfforms.html > > To change your subscription: > http://www.pdfzone.com/discussions/lists-pdfforms.html > > To change your subscription: http://www.pdfzone.com/discussions/lists-pdfforms.html
