Results 1 to 3 of 3

Thread: ASP problem

  1. #1
    Join Date
    May 2004
    Posts
    2

    Exclamation Unanswered: ASP problem

    I have a drop down list that is populated by fields from a table called PayGradeSteps.

    Here is the code
    Do Until RSPayGradeSteps.EOF
    %><% Pay = RSPayGradeSteps("PayStep") & " $ " & RSPayGradeSteps("PaySalary") %> <option Value="<% response.write Pay %>"><% response.write Pay %></option>
    <% RSPayGradeSteps.MoveNext
    Loop


    the drop down list is populated but when I take the values the user selected and insert them my employee table my salary is being cut off. Here is the code for the insert:
    if not isempty(Request.Form("OK")) then
    SField = Request.Form("PaySalary")
    Salary = mid(SField, 6, 4)
    PayStep = mid(SField, 1, 2)
    conn.execute "update tblemployee set " _
    & "Salary = '" & Salary & "', " _
    & "PayStep = '" & Paystep & "', " _
    & "Paygrade = '" & Request.Form("Paysave") & "' " _
    & "where SSN = '" & Request.Form("EmpId") & "' "
    Response.Redirect "./Previous_Addh1.asp?LoginSSN=" & Request.Form("Save1")
    end if
    set RSEmp = conn.execute("select * from TBLemployee where EmpId = '" & EmpId & "' ")

    Can you tell me how I can fix this and also how can you validate that a value is being inserted into the field in the employee table. I have some records where no value was inserted (I cannot duplicate this in my testing though).

    Any help is greatly appreciated.

    Karen

  2. #2
    Join Date
    Dec 2003
    Posts
    148
    What are you tryin to accomplish with the Mid() Function in...

    Salary = mid(SField, 6, 4)

    Have you tried inserts without this? Are they still cut off?
    You can validate something is being entered either wish ASP or with client-side javascript. Usually, most ppl prefer to go with JS..Do you only want to verify that somethnig was entered into the field? If so...use somethin like this..
    http://javascript.internet.com/forms...alidation.html

    there are tons of examples if you search google for "javascript form validation require"

  3. #3
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Javascript Field Validations -- Client Side Scripting by Nannette Thacker - 8/19/1999
    http://www.shiningstar.net/articles/...ions.asp?ID=AW

    Form Validation Using Javascript - 9/19/1998
    http://www.4guysfromrolla.com/webtech/091998-1.shtml
    Good tips such as saving JavaScript functions in a file called DataValidation.js and including this in pages that need this.
    JavaScript functions.

    WebDaily: Your daily source for Web Technology Tips and Tricks! - 10/27/1998
    http://www.4guysfromrolla.com/webtech/102798-1.shtml
    Just checks if fields filled in.

    Form Validation Scripts
    http://www.coolnerds.com/jscript/formval.htm
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •