If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-10-05, 13:08
kclark kclark is offline
Registered User
 
Join Date: May 2004
Posts: 2
Exclamation 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
Reply With Quote
  #2 (permalink)  
Old 01-10-05, 14:50
RhythmAddict RhythmAddict is offline
Registered User
 
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"
Reply With Quote
  #3 (permalink)  
Old 01-10-05, 23:32
Bullschmidt Bullschmidt is offline
Guru
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On