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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Silly Newbie Submit Question

Status
Not open for further replies.

jofarrell

Programmer
Mar 21, 2001
178
US
I have been struggling with getting an ASP page to do what I want it to WHEN I want it to. Because I am querying a database I have basically Three states:
1. user just gets to page and enters all information (an obvious Insert SQL no reloading of page and just submit - works fine)
2. user enters dates tries to get previous data but has none in database (Not an edit so add mode is required but page has to reload with dates still there)
3. User has entered dates hits button to bring back previous data (Works) Now we are into an Update mode.

Here is my question .... can I onclick on the submit button do my Update Set Where ... without ever saying Form.submit??
Or is this needed for something other than what I am seeing as I do not go to another page so I do not need to hand the variables there. This will allow my to separate my UPDATE and INSERT code without all the variables I am seemingly toggling to prevent and set actions I mentioned above.

Sorry if this is confusing and long winded but I am just going crazy and wondered if anyone may be able to shed some light on my problem.

Joanne



 
Joanne,

If I understand your question correctly, you do not want to post to two separate ASP page, but have the data show on the same form. It would probably look something like this.
If not, reply.

Fengshui1998


<html>
<body>
<form name=&quot;myform&quot; method=&quot;post&quot; action=&quot;thispage.asp&quot;>
<%
strdate1 = request.form(&quot;date1&quot;)
strdate2 = request.form(&quot;date2&quot;)
strSQL = &quot;SELECT * FROM table WHERE DATE='&quot; & strdate1 & &quot;'&quot;

rs.open strSQL , Conn
if rs.recordcount = 0 then
rs.addnew
..
..
date1 = strdate1
date2 = strdate2

else
rs.movefirst
date1 = rs(&quot;date1&quot;)
date2 = rs(&quot;date2&quot;)
End if

%>

<br>
<input type=&quot;text&quot; name=&quot;date1&quot; value=&quot;<%=date1%>&quot;>
<input type=&quot;text&quot; name=&quot;date2&quot; value=&quot;<%=date2%>&quot;>
<br><input type=&quot;submit&quot; value=&quot;Submit&quot;>
</body>
</html>



 
Thanks .. I gave up on the thoghts of saving from same page to the database.

I was trying to get the form to allow me to retrieve, add, and edit but as long as you did it in the right order it was ok ... but if you thought you had a retrieval of data and there was none there then it wasnt toggling to allow a save of any new data ...

Because there is a dynamic table on the page it makes it very hard to submit the data to a new form where as on same form I could use the getrows property of the array I created.

Its a little(lot) more complicated then just sending a few fields over ...

Thank you very much for responding

Joanne

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top