[thelist] passing data to an asp page(solution found)

John Mitchell John at persol.net
Tue Dec 9 03:50:58 CST 2003


Hi guys,
I found the solution to the problem. Thanks to all those who showed
interest.
Here is a sample of what I did:

==============================================
<form method="post" action="validate()" name="frmTestForm" >
  <p>&nbsp;</p>
  <table width="75%" border="0">
    <tr> 
      <td>Name: </td>
      <td><input type="text" name="txtName"></td>
    </tr>
    <tr> 
      <td>Health:</td>
      <td><select name="HealthStatus">
          <option value="Good">Good</option>
          <option value="Excellent">Excellent</option>
          <option value="Poor">Poor</option>
          <option value="Uncertain">Uncertain</option>
        </select></td>
    </tr>
    <tr>
      <td><input name="btnSubmit" type="button"  value="Submit"
onClick="validate()"></td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
<Script language="vbscript">
<!--
Option Explicit
Dim btnSubmit

	sub validate()	
		Dim strMsg
			btnSubmit = true
				'make sure the name field is not empty
			If Len(LTrim(frmTestForm.txtName.value ))= 0
Then
				btnSubmit = false
				strMsg = "The Name field cannot remain
empty"
				frmTestForm.txtName.Focus
				btnSubmit = false
			msgBox strMsg
			End if
		if btnSubmit then
			NextPage()
		Else
		End if
	End Sub
			'Code to determine destination		
		sub NextPage()	
		if (document.frmTestForm.HealthStatus.value = "Good")
then
				frmTestForm.action = "HGood.asp"
'object.action=[url string]	 submits details to next page
Elseif (document.frmTestForm.HealthStatus.value = "Excellent") then
				 	frmTestForm.action =
"HExcellent.asp"
		Elseif (document.frmTestForm.HealthStatus.value =
"Poor") then
					frmTestForm.action = "HPoor.asp"
		Elseif (document.frmTestForm.HealthStatus.value =
"Uncertain") then
					frmTestForm.action =
"HUncertain.asp"
		End if
			frmTestForm.submit
		End sub

			
-->
</script>
===============================================



>  -----Original Message-----
> From: 	John Mitchell  
> Sent:	Monday, December 08, 2003 8:43 PM
> To:	'thelist at lists.evolt.org'
> Subject:	passing data to an asp page
> 
> Hi there,
> Please, I want to collect details from a form that a user fills in.
> When the user fills in the form, depending on the value the user will
> select from the menu box in the form, a corresponding page will be
> loaded. Example: if the user selects HEALTH, a page called health.asp
> will be loaded but the rest of the details already filled in (like,
> name, address, etc) will be displayed on health.asp as well as
> health.asp's own contents.
> 
> I have written couple of scripts to do this but there are just not
> working. 
> 
> Any help?
> 
> john


More information about the thelist mailing list