Link to home
Start Free TrialLog in
Avatar of louise_8
louise_8

asked on

classic asp - process code after alert/messagebox answer

Hi

I have a page which currently imports customer data from a file, coded in classic asp.
It has become apparent we now need to ask the user mid processing how they wish to proceed for each record
eg
read customer data and ask the user:
a: if a matching customer record is found in the system, ask do they wish to use this record
b: no matching record, create new
c: let the user enter another customer id, open a search page

Other then rewrite the entire code in asp, all I can think of is inserting javascript mid code then executing the next piece of asp based on that
eg
import data
search for existing customer

<javascript>
confirm box: Possible matching record found, customer id 123, do you wish to proceed Y/N
if yes then
<% function = 1%>
else
<% function = 2%>
</javascript>
<%
if function = 1 then
else..
etc

Though it seems very clunky and there's no option of the customer wishes to enter an id themselves.

Any ideas?
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

You could import the data into a staging table, then display the data to the user providing them the ability to make the needed decisions, and finally migrate the staging/corrected data to your production tables.

Unfortunately, JavaScript will not fire until the ASP page finishes so you would not get the feedback you desire at the time you need it.
just to expand on Shaun's comments...

classic asp is a client/server technology as you know, and the server side code always executed before ANY client side code, so your idea of processing the server side code, then using javascript for a pop up box, then go back to the asp code, will not work.

in this case, I would recommend using AJAX, which allows you to load a page, then make a call back to the server (in this case, check to see if the clientID exists), get some kind of response, and continue base off of the response, all without re-loading the page.

so when the user submits the button, an AJAX call is made to check if the clientID exists. if it does, ask the user what they want to do. if not, create a new one or ask the user if they want to search for one.

using jQuery, AJAX is pretty simple to use - http://api.jquery.com/jquery.ajax/
Avatar of louise_8
louise_8

ASKER

Thanks for your comments, I just want to check the Ajax capabilities before I go researching that.

At present, I import each line in the file into an array
for each line I check the customer then add some transactions based on the file data

so Ajax could handle

 I import each line in the file into an array
for each line I check the customer
**Ajax pop up giving options
then add some transactions based on the file data AND user Ajax choice?
can you describe the overall flow of the page? from a user perspective, what does it do?

I suspect we can streamline the process a bit here.
select a file to import
for each line in the file,  **if the customer doesnt exist, add the customer otherwise use existing customer record.
Add a subscription purchase to the customers account using the file details

the user just selects the file at present then sees
record 1 Customer id xyz successfully purchased product A
record 2 Customer id abc successfully purchased product A

where I have ** I wish to pause the import and ask
a: if a matching customer record is found in the system, ask do they wish to use this record
b: no matching record, create new
c: let the user enter another customer id, open a search page

based on their answer update/add new customer
continue that customers import

continue processing the file.

Maybe its not possible via ASP?
ASKER CERTIFIED SOLUTION
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks, will run by my boss and will let you know