Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript save to sql 2

Status
Not open for further replies.

haytatreides

IS-IT--Management
Oct 14, 2003
94
US
I have a from where the user types a number into an input box, then makes selections on comboboxes (drop downs) and clicks submit. when they click submit, i want to save in a table the number they entered, and their selections. first, is there any other combobox property other than .SelectedIndex that can give me the value or text selected? I dont want to have to write a bunch of select cases.

My other questions may need more clarification. The input box occurs on page load. i save it as a variable, bu when i call my submit() sub, it doesnt pass. should i pass it as an argument?

hayt
 
what i mean is how can i pass it as an argument. i have the html as
<INPUT type="submit" value="Submit" name="Submit_Button" onClick="Submit()">
should i put the argument in there?
 
When you use a form the data entered in the various input elements gets sent automatically to the next page as shown below and on the next page you read them with request.form("myelementname").
Code:
<form name="myform" method="post" action="mypage2.asp">
<input type="text" name="myelementname" size="20" maxlength="15">
<!-- place other INPUT elements here -->
<input type="submit" VALUE="Submit" name="Submit_Button" ALT="Click here to submit">
</form>
That phrase onClick="Submit()" is probably calling a custom JavaScript function on the page to do various things before sending the data on. If you do not have a JavaScript function on the page named "Submit()" then I don't know why you have that there, unless you copied that piece from some othe page somewhere else. (Copying is fine as long as you know what to do with the copied code.)

Or are you perhaps trying to send some data on the URL line that was entered on the page? In that case you would need that Javascript code onClick="Submit()" to get the data put it together and send it, but then on the next page you will need to use request.form("URLelementname") to retrieve the values sent.
 
A minor correction: on that last paragraph I meant to say request.querystring("URLelementname") to retrieve data sent in the URL.
 
disregard my questions. i just set the variable in question to the object in the recordset that i opened. as far as the onclick procedure, there is no javascript. i got that from vb.net or dreamweaver (i cannot remember). it is in the list of html properties.

hayt


thanks

 
hayta,

not sure if this answers your first question, but once the user clicks a particular value from the drop-down menu, that value is automatically saved. In my code sample below, it is referenced through "frm1.sl1.value". hope this helps, and my apologies if this is not what you were looking for...

Code:
<html>
<head>
<script language="VBScript">
Sub DisplayVal
        If frm1.sl1.value = "NULL" Then
        	MsgBox "Please choose a valid value."
        Else
       		MsgBox "The value you chose was: " & frm1.sl1.value
	End If
End Sub
</script>
</head>
<form id="frm1" name="frm1">
<select id="sl1" name="sl1">
	<option value="NULL">- Pick a value below -</option>
	<option value="1">One</option>
	<option value="2">Two</option>
	<option value="3">Three</option>
</select>
<input type="button" value="Display Value" OnClick="DisplayVal()">
</form>
</html>
 
actually, that was my question, but now i have run into a new error. it seems when i open my adodb connection, and test it, and pass it, and go to run the rest of my script (a mailto portion) when i get an error (cause right now my mailto does not work) it gives me the error, and when i close the page and make changes and go to retest, it will not reconnect (the adodb). i have to restart my PC and test it again. it's pretty annoying, especially since i have only half an idea of what to do to get my mailto to work.

hayt

and thanks rob, i changed my code so i could just pull the data over. thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top