This topic is locked

Validate multiple user fields before allowing Add to another table

8/24/2009 11:39:47 AM
ASPRunnerPro General questions
D
deeg author

Hi,
I have a form I am trying to automate. It is a questionnaire that is sent out for response. Each questionnaire has a unique ID. I would like the first page that displays to allow users to type in their First Name, Last Name, UniqueID. I want to check the values against one table (Pool_Table) to see if first, last name, Unique Id exists. If it exists, I want the user to be taken to the Add New page and prefill the fields that they already have entered.
Initially I thought I could use the Add page showing just the three fields (possibly 4), then if the record is valid, take them to the edit page where they can add the additional information.
So here are my objects:
ValidateUser (questionnaire - add table)

Pool_Table (validation table)

EnterDetail (Questionnaire - edit table)

J
Jane 8/25/2009

Hi,
use Before record added event to check entered values and then redirect to another page in the After record added event.

Actual code is dependent on your database structure.

D
deeg author 8/26/2009

Hi Jane,
That part I got, I really need help with how to code. On the event page, it provides sample code, but I am having trouble with coding
User goes to an JS_Questionnnaire_add.asp add page that only shows four fields (Part_No, LName, FName, County). The user enters values.

Table that needs to be checked is: JS_JuryPool - comparing four field values(Part_No, LName, FName, County). If the record exists, I also need to check date field (Transmit_Dte) and if the date is more than 15 days from Now(), then a message should kick back.
If the record exists and the date has not expired, the user should be taken to the edit page of the record where the four entered values from the validation page are prefilled.
I am very unsure about the set up for coding the events.
======

dim rsExists

set rsExists = dal.JS_JuryPool.Query("Part_No='Part_No'","")

if not rsExists.eof then
Response.Redirect "JS_Questionnaire_edit.asp" (need code to take directly to record)

' if record exists do something

(need code here for checking date)

else

' if dont exist do something else

Msg= " The information entered is not valid"
end if
rsExists.Close : set rsExists = Nothing
BeforeAdd=true

J
Jane 8/27/2009

Hi,
I recommend you to publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with detailed description of what you want to achieve.

C
clig 9/3/2009



Hi,
I have a form I am trying to automate. It is a questionnaire that is sent out for response. Each questionnaire has a unique ID. I would like the first page that displays to allow users to type in their First Name, Last Name, UniqueID. I want to check the values against one table (Pool_Table) to see if first, last name, Unique Id exists. If it exists, I want the user to be taken to the Add New page and prefill the fields that they already have entered.
Initially I thought I could use the Add page showing just the three fields (possibly 4), then if the record is valid, take them to the edit page where they can add the additional information.
So here are my objects:
ValidateUser (questionnaire - add table)

Pool_Table (validation table)

EnterDetail (Questionnaire - edit table)


strSQLExists = "SELECT Part_No, LName, FName, County FROM Pool_Table WHERE Part_No=" & dict("Part_No") & "AND LName =" & dict("LName") &...

set rsExists = CreateObject("ADODB.Recordset")

rsExists.Open strSQLExists, dbConnection

if not rsExists.eof then

Session("Part_No") = rsExists("Part_No")

Session("LName") = rsExists("LName")

Session("FName") = ...
else
redirect or script an alert...
end if

rsExists.Close : set rsExists = Nothing
Now defaults can be session vars

  • next you need to do a date compare: would be a if datediff(dd,Transmit_Dte, now() or getdate()) > 15 then... else go to edit
    JS_Questionnaire_edit.asp - to go to this based on all 4 values would require a change from get to post in your search then uses that link filling in all session variables or have a unique index in your table that we got above then you could do JS_Questionnaire_edit.asp?editid1= & Session("uniqueindex")