troubleshooting Question

urgent! validation!

Avatar of justin_316_sr
justin_316_sr asked on
JavaScript
25 Comments1 Solution399 ViewsLast Modified:
scenario: validation for Lname, mname and fname before enabling the rest of the form...

this is my code for agree_process_0817.asp

<%Response.Buffer=True
server.scriptTimeOut = 99999

%>
<%
            Dim loConn, lrsPS, lsSQL,lsAction
            Dim lsAppdate, lsAppPos1, lsAppPos2, lsAppCareer, lsAppdavail, lsLname, lsFname, lsMname, lsNcrAdd,

lsNcrCity
            Dim lsNcrZip, lsNcrContact, lsNcrEmail, lsNcrFlag, lsProvFlag, lsProvAdd, lsProvCity, lsProv, lsZip, lsContactNo,

lsWeight
            Dim lsHeight, lsNationality, lsDob, lsAge, lsPob, lsGender, lsReligion, lsCivilStatus, lsChildren, lsLang, lsOrg,

lsProfExam, lsMajorSys
            Dim BPresentContract, BEmployee, BCourtCase, BCriminalCase

               Set loConn = server.createObject("ADODB.Connection")
            loConn.Open(Application("database"))
            Set ls_AppInfo = server.createObject("ADODB.RecordSet")
            lsAction = request.querystring("action")
            lsModifiedRow = request.form("RandomNum")
            lsAppNumber = request.form("ModifyRecordAppNo")
            Response.Write (lsAction)
            if(lsModifiedRow = "") then
                  lsSQL = "SELECT * FROM hiring WHERE application_no ='" & lsAppNumber &"'"
            End if
            if(lsModifiedRow <> "") then
                  lsSQL = "SELECT * FROM hiring"
            End if
            ls_AppInfo.open lsSQL, loConn, 1, 3
                        lsAppNo = request.form("RandomNum")
                        lsAppdate = request.form("ApplicationDate")
                        lsAppPos1 = request.form("Rb_AppPos1")
                        lsAppPos2 = request.form("Rb_AppPos2")
                        lsAppCareer = request.form("tf_AppCareer")
                        lsAppdavail = request.form("tf_AppDavail")
                        lsLname = request.form("tf_Lname")
                        lsFname = request.form("tf_FName")
                        lsMname = request.form("tf_Mname")
                        lsNcrAdd = request.form("tf_NcrAdd")
                        lsNcrCity = request.form("tf_NcrCity")
                        lsNcrZip = request.form("tf_NcrZip")
                        lsNcrEmail = request.form ("tf_NcrEmail")
                        lsNcrContact = request.form("NcrContact")
                        lsProvFlag = request.form("Cb_ProvFlag")
                        lsProvAdd = request.form("tf_ProvAdd")
                        lsProvCity = request.form("tf_ProvCity")
                        lsProv = request.form("tf_prov")
                        lsZip = request.form("tf_Zip")
                        lsContactNo = request.form("tf_Contact")
                        lsWeight = request.form("tf_Weight")
                        lsHeight = request.form("tf_Height")
                        lsNationality = request.form("tf_Nationality")
                        lsDob = request.form("tf_Dob")
                        lsPob = request.form("tf_Pob")
                        lsAge = request.form("tf_Age")
                        lsGender = request.form("rb_sex")
                        lsReligion = request.form("tf_Religion")
                        lsCivilStatus = request.form("rb_status")
                        lsChildren = request.form("tf_Children")
                        lsLang = request.form("tf_Lang")
                        lsOrg = mid(request.form("tf_Org"), 1, 1000)
                        lsProfExam = mid(request.form("tf_ProfExam"), 1 , 600)
                        lsMajorSys = mid(request.form("tf_MajorSys"),1,2000)
                        BPresentContract = request.form("Rb_PresentContract")
                        BDbsoftEmployee = request.form("Rb_Employee")
                        BCourtCase = request.form("Rb_CourtCase")
                        BCriminalCase = request.form("Rb_CriminalCase")
'------------------------------------------Saving for Hiring and Skills---------------------------------------------
                  if (lsAppNumber= "") then
                    ls_AppInfo.AddNew
                       ls_AppInfo("application_no")=lsAppNo
                  end if
                        ls_AppInfo("application_date")=lsAppdate
                        ls_AppInfo("application_pos1")=lsAppPos1
                        ls_AppInfo("application_pos2")=lsAppPos2
                        ls_AppInfo("application_career_goal")=lsAppCareer
                        if(lsAppdavail="") then lsAppdavail= null End if
                        ls_AppInfo("application_date_available")=lsAppdavail
                        ls_AppInfo("application_lastname")=lsLname
                        ls_AppInfo("application_firstname")=lsFname
                        ls_AppInfo("application_middlename")=lsMname
                        ls_AppInfo("application_ncr_email")=lsEmail
                        ls_AppInfo("application_ncr_address")=lsNcrAdd
                        ls_AppInfo("application_ncr_city")= lsNcrCity
                        ls_AppInfo("application_ncr_zip")=lsNcrZip
                        ls_AppInfo("application_ncr_contactno")=lsNcrContact
                        ls_AppInfo("application_ncr_email")= lsNcrEmail
                        If lsProvFlag = "on" then lsProvFlag="1" else lsProvFlag = "0" End if
                        ls_AppInfo("application_prov_flag")=lsProvFlag
                        ls_AppInfo("application_prov_address")= lsProvAdd
                        ls_AppInfo("application_prov_city")=lsProvCity
                        ls_AppInfo("application_province")=lsProv
                        ls_AppInfo("application_zip")=lsZip
                        ls_AppInfo("application_contact_no")=lsContactNo
                        ls_AppInfo("application_weight")=lsWeight
                        ls_AppInfo("application_height")=lsHeight
                        ls_AppInfo("application_nationality")=lsNationality
                        if(lsDob="") then lsDob= null End if
                        ls_AppInfo("application_dob")=lsDob
                        if(lsAge="") then lsAge= null End if
                        ls_AppInfo("application_age")= lsAge
                      ls_AppInfo("application_religion")=lsReligion
                        ls_AppInfo("application_civil_status")=lsCivilStatus
                        if(lsChildren="") then lsChildren= null End if
                        ls_AppInfo("application_children")=lsChildren
                        ls_AppInfo("application_languages")=lsLang
                     ls_AppInfo("application_organization")=lsOrg
                        ls_AppInfo("application_prof_exam")= lsProfExam
                        ls_AppInfo("application_major_system")=lsMajorSys
                        ls_AppInfo("application_court_case") = BCourtCase
                        ls_AppInfo("application_criminal_record") = BCriminalCase
                        ls_AppInfo("application_employee") = BEmployee
                        ls_AppInfo("application_present_contract") = BPresentContract
            ls_AppInfo.Update
        ls_AppInfo.close
        Set ls_AppInfo = nothing
%>


after this code...i intend to place the following code for the validation of first, middle and last name..

<%
        Dim lsLName, lsMName, lsFName
        Set ls_AppInfo = server.createObject("ADODB.Recordset")
        lsSQL = "SELECT * FROM hiring WHERE FName = '"&request.form("tf_FName")&"' AND LName =

'"&request.form("tf_LName")&"' AND MName =          
          '"&request.form("tf_MName")&"'
       ls_AppInfo.open lsSQL, loConn, 1, 3
          if (!(ls_AppInfo.EOF) then
                document.write("You have already registered!")
                End if
         ls_AppInfo.close
         Set ls_AppInfo = nothing
%>


what i want to accomplish is this...

a. when user loads the page..all the fields are disable except for FIRST NAME, MIDDLE NAME, LAST NAME, and the VALIDATE

button..

b. when user leaves the 3 fields blank..and clicks validate, an alert will be displayed..(i've done this part)

c. when user leaves one or two fields blank, and clicks validate, the alert will again be displayed..(i've done this part)

d. when the user completes the 3 fields correctly, and clicks validate..processing will occur in the agree_process_0818.asp to

check if the user has already registered or not..

e. note: anne monique morrie is different from anne marie morrie..and so there should be no error on this part..

f. when the first, middle and last name exist in the database..it should return an alert saying he/she has already registered..

g. when the first, middle and last name does not exist yet in the database, it should be able to enable the rest of the fields

which were disabled upon load of the page..

h. note: the agree button will also use agree_process_0818.asp for the processing...(this is working already)

<form name = "App_Form" method="post" action="application_form_0818.asp?action=reload">

<font face="Arial"><input type="submit" name="validate" value="Validate" class="subbuttonctl"></font>

<input type="button" id="agree" name="Save" value="Agree" class="subbuttonctl" onClick="ufAgree()">

function ufAgree()
{
       var checking = true;
       checking = (checking==true) ? ufCheckDate() : checking
       checking = (checking==true) ? ufCheckBirthDate() : checking
       checking = (checking==true) ? ufCheckEmail() : checking
       checking = (checking==true) ? ufcheckRadio() : checking
      checking = (checking==true) ? ufcheckAddress() : checking


       if (checking==true)
      {
       if (document.App_Form.ModifyRecordAppNo.value=="")
       {
              document.App_Form.RandomNum.value = GetRandomNumber();
              document.App_Form.action="Agree_Process_0817.asp"
              document.App_Form.submit();
      }
      else
      {
                    var ModifyRecord
                    document.App_Form.RandomNum.value = ""
              document.App_Form.action="Agree_Process_0817.asp"
              document.App_Form.submit();

      }
      }
}

please help me..this is really urgent! please!! thank you!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 25 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 25 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros