Forums
This topic is locked
Adding Date (Dropdown->Hidden Field->Database)
23 Mar 2006 10:12:58 dako cada posted:
Ok I know I suck at this but can you guys help with this I really need it for my training courseIts a Blank Page with 3 Dropdowns, Month,Day,Year Respectively
1 Hidden Field (This is meant to sture the full Date)
1 text box (just shows the value taht is the same as whats to be put in the hidden field)
and a submit button
From what I can tell The dropdown puts the values in the Hidden Field just fine the problem is (me the dumbass speaking) that the form is submitted before the value is set.
This is probably a bad way of doing this sort of form but can you guys help fix it or guide me on how to make a working form for this task
Any help is greatly appreciated
Tnx ion advance
---------------------------------------------------------------------------------------------------------------------------------------
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" debug="true" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
If IsPostBack Then
txtFullDate.text = ddlMonth.SelectedItem.value &"/"& ddlDay.SelectedItem.value &"/"& ddlYear.SelectedItem.value
End If
End Sub
</script>
<MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert
runat="server"
CommandText='<%# "INSERT INTO Test4Date (TestDate) VALUES (?)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_Company" %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_Company" %>'
Expression='<%# Request.Form("MM_Insert" = "form1" %>'
CreateDataSet="false"
Debug="true"
>
<Parameters>
<Parameter Name="@TestDate" Value='<%# IIf((Request.Form("TestDate" <> Nothing), Request.Form("TestDate", "" %>' Type="Date" />
</Parameters>
</MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert>
<MMataSet
id="DSDate"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_Company" %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_Company" %>'
CommandText='<%# "SELECT * FROM Test4Date" %>'
Debug="true"
></MMataSet>
<MM<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>ageBind runat="server" PostBackBind="true" />
<head>
<title>Add New Sell Offer</title>
</head>
<body>
<form method="post" name="form1" runat="server">
<aspropDownList ID="ddlMonth" OnSelectedIndexChanged="Page_Load" runat="server">
<asp:ListItem Value="01">Jan</asp:ListItem>
<asp:ListItem Value="02">Feb</asp:ListItem>
<asp:ListItem Value="03">Mar</asp:ListItem>
</aspropDownList>
<aspropDownList ID="ddlDay" OnSelectedIndexChanged="Page_Load" runat="server">
<asp:ListItem Value="01">01</asp:ListItem>
<asp:ListItem Value="02">02</asp:ListItem>
<asp:ListItem Value="03">03</asp:ListItem>
</aspropDownList>
<aspropDownList ID="ddlYear" OnSelectedIndexChanged="Page_Load" runat="server">
<asp:ListItem value="2006">2006</asp:ListItem>
<asp:ListItem value="2007">2007</asp:ListItem>
<asp:ListItem value="2008">2008</asp:ListItem>
</aspropDownList>
<table align="center">
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insert record"></td>
</tr>
</table>
<p> </p>
<p>
<asp:TextBox ID="txtFullDate" runat="server" /> </p>
<p>
<input type="hidden" name="TestDate" value="(<%=ddlMonth.SelectedItem.value &"/"& ddlDay.SelectedItem.value &"/"& ddlYear.SelectedItem.value%><img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>">
<input type="hidden" name="MM_insert" value="form1">
</p>
</form>
<p> </p>
</body>
</html>
Edited by - dakocada on 23 Mar 2006 10:14:34
Replies
Replied 23 Mar 2006 10:15:00
23 Mar 2006 10:15:00 dako cada replied:
damn smilies