[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

AGE VERIFICATION SCRIPT NEEDED

Posted on 2004-04-01
2
Medium Priority
?
825 Views
Last Modified: 2012-06-21
Hi Experts,

I need to verify an age input to ensure that the user who inputs their age on a form is under 65 years old. The age input is as follows:

          <select name="dobDay" size="1" class="formStyle">
            <option value="-1">Day</option>
            <%
                        FOR i = 1 TO 31
                          m = " "
                          IF i = DatePart("d",Now) THEN
                      m = " selected "
                          END IF
                    %>
            <option<%=m%>value="<%=i%>"><%=i%></option>
            <%
                        NEXT
                    %>
          </select>
      /
      <select name="dobMonth" size="1" class="formStyle">
        <option value="-1">Mth</option>
        <%
                      FOR j = 1 TO 12
                          m = " "
                          IF j = DatePart("m",Now) THEN
                      m = " selected "
                          END IF
                   %>
        <option<%=m%>value="<%=j%>"><%=j%></option>
        <%
                        NEXT
                  %>
      </select>
      /
      <select name="dobYear" size="1" class="formStyle">
        <option value="-1">Yr</option>
        <%
                        FOR k = CInt(DatePart("yyyy",Now))-66 TO DatePart("yyyy",Now)
                          m = " "
                          IF k = DatePart("yyyy",Now) THEN
                      m = " selected "
                          END IF
                  %>
        <option<%=m%>value="<%=k%>"><%=k%></option>
        <%
                        NEXT
                  %>
      </select>


So it's a 3 drop down date input "dobDay" "dobMonth" dobYear"


Do any of you have any examples I could use?



Thanks,



PJORDANNA

0
Comment
Question by:pjordanna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:pjordanna
ID: 10730990
The validation will occur on the form submit.



PJORDANNA
0
 
LVL 6

Accepted Solution

by:
jarasa earned 2000 total points
ID: 10731237
Take a look at this and you can make the appropite changes:

// Check that string theField.value is a valid Year.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function checkYear (theField, emptyOK)
{   if (checkYear.arguments.length == 1) emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    if (!isYear(theField.value, false))
       return warnInvalid (theField, iYear);
    else return true;
}


// Check that string theField.value is a valid Month.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function checkMonth (theField, emptyOK)
{   if (checkMonth.arguments.length == 1) emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    if (!isMonth(theField.value, false))
       return warnInvalid (theField, iMonth);
    else return true;
}


// Check that string theField.value is a valid Day.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function checkDay (theField, emptyOK)
{   if (checkDay.arguments.length == 1) emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    if (!isDay(theField.value, false))
       return warnInvalid (theField, iDay);
    else return true;
}



// checkDate (yearField, monthField, dayField, STRING labelString [, OKtoOmitDay==false])
//
// Check that yearField.value, monthField.value, and dayField.value
// form a valid date.
//
// If they don't, labelString (the name of the date, like "Birth Date")
// is displayed to tell the user which date field is invalid.
//
// If it is OK for the day field to be empty, set optional argument
// OKtoOmitDay to true.  It defaults to false.

function checkDate (yearField, monthField, dayField, labelString, OKtoOmitDay)
{   // Next line is needed on NN3 to avoid "undefined is not a number" error
    // in equality comparison below.
    if (checkDate.arguments.length == 4) OKtoOmitDay = false;
    if (!isYear(yearField.value)) return warnInvalid (yearField, iYear);
    if (!isMonth(monthField.value)) return warnInvalid (monthField, iMonth);
    if ( (OKtoOmitDay == true) && isEmpty(dayField.value) ) return true;
    else if (!isDay(dayField.value))
       return warnInvalid (dayField, iDay);
    if (isDate (yearField.value, monthField.value, dayField.value))
       return true;
    alert (iDatePrefix + labelString + iDateSuffix)
    return false
}

Javier
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question