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

Date Function Include File....Problemos....

Status
Not open for further replies.

qberta01

Programmer
Nov 14, 2005
113
Hello,

I cannot seem to figure this one out. I have several reports that I call through ASP pages. 98% of the reports use some type of date selection formula. To save myself the hassle of rewriting date selection combo boxes for every page, I created an include file. I call this file from my report pages and the dates show just fine. Now what I would like to do is be able to make my selection, click a button, capture the selected values and continue to run code in that very same page.

Some code examples:

This is some of the include file code:

Public Function Select_Date()

Dim dYr

dYr = Year(NOW())

<Select id='BYear' size='1' NAME=BeginYear>
<option value = '<%=dyr%>'><%=dyr%></option>
<option value = '<%=dyr-1%>'><%=dyr-1%></option>
<option value = '<%=dyr-2%>'><%=dyr-2%></option>
</select>

End Function

----------------------------------------

This is some of my report.asp code:

<FORM Name='Report' action='Report.asp' METHOD=POST ID="Form1">

<%response.Write Select_Date()%>
<P class="ReportBody">
<INPUT type='button' value='Run Report' id="Button1" name=submit1>
<br>
<br>
</form>

----------------

The combobox shows fine, but once the Run Report button is clicked I would like to capture the actual date value and use it to execute more code in the Report.asp page.

Any help is greatly appreciated.

Q

 
That function appears to run on the server at the time that the server builds the HTML that goes into the HTTP Response, that gets sent to the browser.

The browser renders the HTML form, and the clicking of the button is a browser-side event. If the button was of type="submit" instead of type="button" then it would cause the browser to send a new "POST" HTTP Request to the server.

Do you wish to execute more code on the browser side when the button is clicked or on the server once the submitted HTTP Request is received?

If the latter
 
If the latter then change the button type to "submit" and add in your server-side code something to detect that the form was submitted like this:
<%
IF Request.Form("submit1") <> "" THEN
'put code here to process submitted form
END IF
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top