Go Back   Dreamweaver Club Forums > Hand Coders Forum > ASP
Register FAQ Members List Search Today's Posts Mark Forums Read

Thread Tools Display Modes
Old 12-18-2011, 06:43 PM   #1
Join Date: Dec 2011
Posts: 1
Default Add days to date and the resulted date entered in other text field

I have form within three fields (date of sample, days of testing, date reporting)
I want to add the days to (date of sample field) by the interval entered by user in (days of testing field) to give the result in (date reporting field).
I try to use java scripts but not successful
I hope find way by ASP VBscript
The code of page:
<!--#include file="Connections/connection.asp" -->
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
MM_IIf = ifTrue
End If
End Function
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd

Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_connection_STRING
MM_editCmd.CommandText = "INSERT INTO Reg_Cubes_tbl (dteDATE_SampRECEIVED, intTargetTimeByDays, dteEXP_REPORT_DATE) VALUES (?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 135, 1, -1, MM_IIF(Request.Form("dteDATE_SampRECEIVED"), Request.Form("dteDATE_SampRECEIVED"), null)) ' adDBTimeStamp
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("intTargetTimeByDays"), Request.Form("intTargetTimeByDays"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 135, 1, -1, MM_IIF(Request.Form("dteEXP_REPORT_DATE"), Request.Form("dteEXP_REPORT_DATE"), null)) ' adDBTimeStamp

' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "RegCube3.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
End If
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<form action="<%=MM_editAction%>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">date of sample:</td>
<td><input type="text" name="dteDATE_SampRECEIVED" value="" size="32" /></td>
<tr valign="baseline">
<td nowrap="nowrap" align="right">days of testing:</td>
<td><input type="text" name="intTargetTimeByDays" value="" size="32" /></td>
<tr valign="baseline">
<td nowrap="nowrap" align="right">date reporting:</td>
<td><input type="text" name="dteEXP_REPORT_DATE" value="" size="32" /></td>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td><input type="submit" value="Insert record" /></td>
<input type="hidden" name="MM_insert" value="form1" />

Last edited by a_afiaax; 12-18-2011 at 06:48 PM..
a_afiaax is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:52 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.