building asp page based on data validation
I am new at asp. I am trying to create an online form, that builds progressively as the user fills it in and validates some parts of it. My problem is I don't know how to "go validate" and come back into the page to "write" more of the page if the data was valid.
Could anyone please look at: http://www-app2.wa.gov/dshs/trial/ddd/casis.html ?
I have a demo set up as html and javascript that demonstrates the functionality of what I'm trying to accomplish (I'm building a separate asp page, this was just a demo).
Here's what needs to happen:
The user enters a case # and hits the submit button.
The submit button initiates the validation process (not sure how to do this without going to another page that runs the stored procedure)
If the case # is valid, then another section of the form appears (use reponse.write?). Some of the fields in the form will be pre-populated and I will disable those fields so the user can't change them. The user will fill in some fields.
Lastly, for that section, the user will enter the Provider # and the process will repeat on down the page.
At the very end the user will submit the entire form.
What I can't get past mentally, that if the case # and Provider # are validated using form submittal, and then the entire thing is a form , that this is nested forms!
Ugh. I feel so dumb on this. Believe me, when I finally get this my life will never be the same!
Thanks!
Peter J. Boettcher posted this at 13:51 — 27th March 2002.
They have: 812 posts
Joined: Feb 2000
Just submit the form to itself and use querystring values to go through the different steps.
For example:
<%
Dim intStep
intStep = Request.QueryString("step")
Select Case intStep
Case 1
Code goes here
Case 2
Code goes here
Case Else
Code goes here
End Select
%>
<form>
<% If intStep = 1 Then %>
form stuff here
<% ElseIf intStep = 2 Then %>
more form stuff here
<% Else %>
default for stuff here
<% End If %>
</form>
PJ | Are we there yet?
pjboettcher.com
Angela French posted this at 17:34 — 27th March 2002.
They have: 12 posts
Joined: Mar 2002
what you have suggested makes sense and is the direction I head with my work on it yesterday. I have a question about your suggestion through --
In your select case statement, the block of code that is executed if the case is met -- what I want is to do a response.write that displays the form. Is it okay to do it that way? I like how you put all your form code together, but if I did it that way, what goes in the case statement?
Peter J. Boettcher posted this at 17:43 — 27th March 2002.
They have: 812 posts
Joined: Feb 2000
You can do it either way. I separated them to make it easy to explain. What you could do is have a variable to hold the form string and then build that in your select statement.
For example:
Dim intStep
Dim strBuildForm
intStep = Request.QueryString("step")
Select Case intStep
Case 1
strBuildForm = "tags and stuff go in here"
Case 2
strBuildForm = "more tags and stuff go in here"
Case Else
strBuildForm = "and more tags and stuff go in here"
End Select
Response.Write strBuildForm
%>
PJ | Are we there yet?
pjboettcher.com
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.