[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!

4.6

POINTS  INCREASED and question simplified! ASP Validate.

Asked by champ_010 in Active Server Pages (ASP)

Tags: e_mail, field, function, validate

O.K., since I haven't received any scripts, I've simplified this question from the original (see below). Nevermind the hidden forms that appear--I've gotten rid of them, there is only one form now.  How about a standard ASP validation script that will validate the text fields (email requiring "@" and numbers like phone number and ID number required to be numbers).  Please write the error messages to a seperate page.  Else if everything is alright--Response.write the selected radio button, the selected in dropdown list 1 and 2, and of course the contents of text fields and dropdown lists (birthdate, Dep No.).

Sorry for the hassel, points have been increased for a speedy response.  Yes please use the ASP sample below for preferred format--changing anything that makes more sense.

Points are for a script that once I load to a server along with my HTML page, should run. (Yes I will have to look into getting a hold of IIS).

Thanks.

Here is the new version of the form to be validated:


html>
head>
title>Form/title>
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
/head>

body>
FORM name="ConFrm">
table border="0" cellspacing="0" cellpadding="0">
tr align="left">
  td nowrap height="11">  
   
input name="radFirst" type="radio" value=1 onclick="nextGroup(this.value)">Customer1
input name="radFirst" type="radio" value=2 onclick="nextGroup(this.value)">Customer2
input name="radFirst" type="radio" value=3 onclick="nextGroup(this.value)">Customer3
p>
select name="prodType" size="1" onChange="nextGroup1(this.options.selectedIndex)">
option value=" " selected> /option>
option value=" " selected>---Select From First Menu--------------/option>
option value=" " selected>---Select From First Menu--------------/option>
/select>
/p>
p>
select name="inqType" size="1" >
option value=" " selected> /option>
option value=" " selected>---Select From First Menu----------------/option>
option value=" " selected>---Select From First Menu----------------/option>
/select>
/p>

script>
!--

var groups = document.all("radFirst").length + 1 //+ 1 if for the drop down item select...

var group=new Array(groups)
for (i=0; igroups; i++)
group[i]=new Array()

group[0][0]=new Option("---Select From the Menu Above---"," ");

group[1][0]=new Option("---Select From This 2nd Menu---"," ");
group[1][1]=new Option("mbType1","47");
group[1][2]=new Option("mbType2","46");
group[1][3]=new Option("mbType3","45");

group[2][0]=new Option("--Select From This 2nd Menu---"," ");
group[2][1]=new Option("nonType1","115");
group[2][2]=new Option("nonType2","116");
group[2][3]=new Option("nonType3","45");

group[3][0]=new Option("--Select From This 2nd Menu---"," ");
group[3][1]=new Option("baType1","115");
group[3][2]=new Option("baType2","116");
group[3][3]=new Option("baType3","45");

var temp=document.ConFrm.prodType

function nextGroup(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;igroup[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
nextGroup1(0)
}

var questionss=document.ConFrm.prodType.options.length
var questions=new Array(groups)
for (i=0; igroups; i++)  {
questions[i]=new Array(group[i].length)
for (j=0; jgroup[i].length; j++)  {
questions[i][j]=new Array()  }}

questions[0][0][0]=new Option("---Select---"," ");
questions[1][0][0]=new Option("---Select From the 2nd Menu---"," ");
questions[1][1][0]=new Option("Select From This 3rd Menu"," ");
questions[1][1][1]=new Option("mDtInq1");
questions[1][1][2]=new Option("mDtInq2");
questions[1][1][3]=new Option("mDtInq3");

questions[1][2][0]=new Option("Select From This 3rd Menu");
questions[1][2][1]=new Option("mEhInq1");
questions[1][2][2]=new Option("mEhInq2");
questions[1][2][3]=new Option("mEhInq3");

questions[1][3][0]=new Option("Select From This 3rd Menu");
questions[1][3][1]=new Option("mHsInq1");
questions[1][3][2]=new Option("mHsInq2");
questions[1][3][3]=new Option("mHsInq3");

questions[2][0][0]=new Option("---Select From the 2nd Menu---");
questions[2][1][0]=new Option("Select From This 3rd Menu");
questions[2][1][1]=new Option("nonIPInq1");
questions[2][1][2]=new Option("nonIPInq2");
questions[2][1][3]=new Option("nonIPInq3");

questions[2][2][0]=new Option("Select From This 3rd Menu"," ");
questions[2][2][1]=new Option("nonGrInq1");
questions[2][2][2]=new Option("nonGrInq2");
questions[2][2][3]=new Option("nonGrInq3");

questions[2][3][0]=new Option("Select From This 3rd Menu"," ");
questions[2][3][1]=new Option("nonTrvInq1");
questions[2][3][2]=new Option("nonTrvInq2");
questions[2][3][3]=new Option("nonTrvInq3");

questions[3][0][0]=new Option("---Select From the 2nd Menu---");
questions[3][1][0]=new Option("Select From This 3rd Menu"," ");
questions[3][1][1]=new Option("baDtInq1");
questions[3][1][2]=new Option("baDtInq2");
questions[3][1][3]=new Option("baDtInq3");

questions[3][2][0]=new Option("Select From This 3rd Menu");
questions[3][2][1]=new Option("baEhInq1");
questions[3][2][2]=new Option("baEhInq2");
questions[3][2][3]=new Option("baEhInq3");

questions[3][3][0]=new Option("Select From This 3rd Menu");
questions[3][3][1]=new Option("baHsInq1");
questions[3][3][2]=new Option("baHsInq2");
questions[3][3][3]=new Option("baHsInq3");

var temp1=document.ConFrm.inqType
function nextGroup1(y){
var selRadio;
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;iquestions[document.all("radFirst").length][y].length;i++)
{
     for(k=0;kdocument.all("radFirst").length;k++)
     {
          if (document.ConFrm.radFirst[k].checked == true)
               selRadio = k;          
     }
temp1.options[i]=new Option(questions[document.ConFrm.radFirst[selRadio].value][y][i].text,questions[document.ConFrm.radFirst[selRadio].value][y][i].value)
}
temp1.options[0].selected=true
}

function nextGroup2(z){
window.location=temp1[z].value
}

//-->
/script>

/td>
/tr>

/table>
p>
p>
p>
p>
      First Name: input type="text" name="first_name">   
      Last Name: input type="text" name="last_name">

      E-mail: input type="text" name="e_mail">

      Phone Number: input name="area_code" type="text" size="3" maxlength="3">
              input name="phone_number" type="text" size="10" maxlength="8">
  p> Customer No:
    input type="text" name="group_number">
   

    ID No:
    input type="text" name="group_id">
   

    Date of Birth:
    select name="birth_date">
      option>1/option>
      option>2/option>
      option>3/option>
      option>4/option>
      option>5/option>
      option>6/option>
      option>7/option>
      option>8/option>
      option>9/option>
      option>10/option>
      option>11/option>
      option>12/option>
      option>13/option>
      option>14/option>
      option>15/option>
      option>16/option>
      option>17/option>
      option>18/option>
      option>19/option>
      option>20/option>
      option>21/option>
      option>22/option>
      option>23/option>
      option>24/option>
      option>25/option>
      option>26/option>
      option>27/option>
      option>28/option>
      option>29/option>
      option>30/option>
      option>31/option>
    /select>
    select name="birth_month">
      option>Jan/option>
      option>Feb/option>
      option>Mar/option>
      option>Apr/option>
      option>May/option>
      option>Jun/option>
      option>Jul/option>
      option>Aug/option>
      option>Sep/option>
      option>Oct/option>
      option>Nov/option>
      option>Dec/option>
    /select>
    input name="birth_year" type="text" size="6" maxlength="4">
  p>DepNo.:
    select name="select">
      option>00/option>
      option>01/option>
      option>02/option>
    /select>
  p>Company No.
    input name="textfield" type="text" size="6" maxlength="6">
    PIN:
    input name="textfield3" type="text" size="8" maxlength="8">
 
  p>
 input type="button" VALUE="Send Request"       onClick="document.forms[contactForm].submit();document.forms[showForm2].submit()">
       
    input name="reset" type="submit" id="reset" value="Reset">
 /p>
 
/form>

/body>
/html>

**********PREVIOUS VERSION OF THE QUESTION************

Here is a  form where the first three choices made by the user from radio buttons and drop-down menus, makes another form appear below using JavaScript.

The form above obviously doesn't need to be validated, but the second form that appears, needs to be validated.

Can someone please provide an ASP script that will perform validation on whichever form is chosen to appear below the main form--including the error messages  when necessary pertinant to that form if and when chosen.
(I have included an example of the coding style I started to write).

I don't have server on my own computer and therefore unable to write and test ASP and am in a real bind at the moment!  Points awarded to the script that validates the form(s) below when I take it to a borrowed computer as soon as I receive any replies.

Thank you in advance for helping.



*************SAMPLE ASP CODE STYLE***********************

Would like code to be explicit like this:

      DIM strDate, strFirstName, strLastName, strEmail, strAreaCode, strPhone
                                                DIM strGroupNo, strGroupId, strInquiry, strBaUsername, strBaPassword, strProviderId
                                                DIM strPaymentPIN

                                                strDate = ""
                                                'Fields determined from entry form
                                                strFirstName = ""
                                                strLastName = ""
                                                strEmail = ""
                                                strAreaCode = ""
                                                strPhone = ""
                                                strGroupNo = ""
                                                strIdNo = ""
                                                strInquiry = ""
                                                strBaUsername = ""
                                                strBaPassword = ""
                                                strProviderId = ""
                                                strPaymentPIN = ""
                                                
                                                'an error message indicating missing mandatory fields
                                                strErrorMsg = ""
                                                
                                                ' Fields taken from form
                                                strFirstName = Request.Form("firstName")
                                                strLastName = Request.Form("lastName")
                                                strEmail = Request.Form("email")
                                                strAreaCode = Request.Form("areaCode")
                                                strPhone = Request.Form("phoneNumber")
                                                strGroupNo = Request.Form("groupNumber")
                                                strGroupId = Request.Form("groupId")
                                                strBaUsername = Request.Form("baUserName")
                                                strBaPassword = Request.Form("baPassword")
                                                strCompanyPIN = Request.Form("companyPIN")
                                                strPaymentNo = Request.Form("paymentNo")
                                                
                                                if isEmpty(strFirstName) then '(strFirstName = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>First Name/span>/li>"
                                                end if

                                                if isEmpty(strLastName) then '(strLastName = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Last Name/span>/li>"
                                                end if
                                                
                                                if isEmpty(strEmail) Then '(strEmail = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Title/span>/li>"
                                                end if
                                                
                                                if isEmpty(strAreaCode) Then '(strAreaCode = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Company Name/span>/li>"
                                                end if
                                                
                                                if isEmpty(strPhone) Then '(strPhone = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Group Name/span>/li>"
                                                end if
                                                
                                                if isEmpty(strGroupNo) Then '(strGroupNo = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Group Number/span>/li>"
                                                end if
                                                
                                                if isEmpty(str) Then '(strGroupId = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Email/span>/li>"
                                                end if
                                                
                                                if isEmpty(strBaUsername) Then '(strBaUsername = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Business Phone (including area code)/span>/li>"
                                                end if
                                                
                                                if isEmpty(strBaPassword) Then '(strBaPassword = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Business Phone (including area code)/span>/li>"
                                                end if
                                                
                                                if isEmpty(strProviderId) Then '(strProviderId = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Business Phone (including area code)/span>/li>"
                                                end if
                                                
                                                if isEmpty(strPaymentPIN) Then '(strPaymentPIN = "") then
                                                   strErrorMsg = strErrorMsg & "li>span class='h3'>Business Phone (including area code)/span>/li>"
                                                end if
                                                
                                                                                                
                                                if NOT isEmpty(strErrorMsg) Then 'strErrorMsg > "" then
                                                   Response.Write "
p class='body'>The following fields are blank or invalid in the previous form. Please "
                                                   Response.Write "a href=JavaScript:history.go(-1)> go back/a>"
                                                   Response.Write " and fill out the required information:UL>" & strErrorMsg & "/UL>/p>"
                                                
                                                else
[+][-]11/19/02 02:44 AM, ID: 7468029Expert 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.

 
[+][-]11/19/02 02:55 AM, ID: 7468057Expert 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.

 
[+][-]11/19/02 10:22 AM, ID: 7469801Author 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.

 
[+][-]11/19/02 09:28 PM, ID: 7471875Author 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.

 
[+][-]11/20/02 01:37 AM, ID: 7472448Expert 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.

 
[+][-]11/20/02 05:21 AM, ID: 7473070Expert 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.

 
[+][-]11/20/02 05:43 AM, ID: 7473141Expert 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.

 
[+][-]11/20/02 07:08 AM, ID: 7473564Expert 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.

 
[+][-]11/20/02 09:50 AM, ID: 7474428Author 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.

 
[+][-]11/20/02 10:01 AM, ID: 7474486Expert 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.

 
[+][-]11/20/02 10:31 AM, ID: 7474604Expert 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.

 
[+][-]11/20/02 01:22 PM, ID: 7475436Author 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.

 
[+][-]11/20/02 01:39 PM, ID: 7475496Expert 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.

 
[+][-]11/20/02 02:04 PM, ID: 7475586Author 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.

 
[+][-]11/20/02 03:49 PM, ID: 7475917Author 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.

 
[+][-]11/20/02 03:55 PM, ID: 7475927Author 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.

 
[+][-]11/20/02 04:05 PM, ID: 7475953Author 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.

 
[+][-]11/20/02 08:24 PM, ID: 7476566Author 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.

 
[+][-]11/20/02 09:20 PM, ID: 7476671Expert 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.

 
[+][-]11/21/02 12:32 AM, ID: 7477135Author 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.

 
[+][-]11/21/02 02:05 AM, ID: 7477420Accepted 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

Zone: Active Server Pages (ASP)
Tags: e_mail, field, function, validate
Sign Up Now!
Solution Provided By: Gorazd
Participating Experts: 4
Solution Grade: A
 
[+][-]11/21/02 10:00 AM, ID: 7479530Author 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...
20091111-EE-VQP-89