I am attempting to dynamically add a TextBox with the ID "tbComment" when the selected date is less than the current date on the client side, prior to hitting the submit button.
Which approach would be the most effective in achieving this? I have tried using JavaScript, but for some reason the page failed to load.
I am aware of the "onTextChanged" event for a TextBox, which can trigger a JavaScript function. But how can this be implemented to dynamically add HTML when the selected date is less than the current date on the client side?
<table class="sidemenu" id="BudgetDetailsTable" align="left" border="0" runat="server"
width="100%">
<tr>
<td width="20%">
Project Period Start Date:
</td>
<td width="80%">
<asp:TextBox ID="txtFromDate" title="Click to select date" Style="cursor: pointer"
runat="server" CssClass="textboxunderline" EnableViewState="true" TabIndex="1"></asp:TextBox><asp:RequiredFieldValidator
ID="rfvFromDate" runat="server" ErrorMessage="<br /> - Please provide Start Date."
ControlToValidate="txtFromDate">*</asp:RequiredFieldValidator><asp:CompareValidator
ID="cvFromDate" runat="server" ErrorMessage="<br /> - Please provide valid From date. From date should be before End date."
ControlToValidate="txtFromDate" Display="dynamic" Type="Date" Operator="LessThanEqual"
ControlToCompare="txtEndDate">*
</asp:CompareValidator>
<asp:CustomValidator ID="cvBeforeDate" runat="server" ErrorMessage="<br /> - Please provide a reason to for adding a sheet having start date before today's date."
OnServerValidate="cvCheck_StartDate">* </asp:CustomValidator>
</td>
</tr>
<tr>
<td width="20%">
Project Period End Date:
</td>
<td width="80%">
<asp:TextBox ID="txtEndDate" title="Click to select date" Style="cursor: pointer"
runat="server" CssClass="textboxunderline" EnableViewState="true" TabIndex="2"></asp:TextBox><asp:RequiredFieldValidator
ID="rfvEndDate" runat="server" ErrorMessage=" <br /> - Please provide End Date."
ControlToValidate="txtEndDate">* </asp:RequiredFieldValidator><asp:CompareValidator
ID="cvEndDate" runat="server" ErrorMessage="<br /> - Please provide valid End date. End date should be larger than From date."
ControlToValidate="txtEndDate" Display="dynamic" Type="Date" Operator="GreaterThanEqual"
ControlToCompare="txtFromDate">*
</asp:CompareValidator>
<asp:CustomValidator ID="cvDateMonth" runat="server" ErrorMessage="<br /> - Please provide start day and month different to end day and month."
ClientValidationFunction="cvDateMonth_ServerValidate">*</asp:CustomValidator>
</td>
</tr>
<tr>
<td width="20%" >
<asp:Label ID="Reason" CssClass="sidemenu" runat="server" Visible="False">Reason:</asp:Label>
</td>
<td width="80%" >
<asp:TextBox ID="tbComment" runat="server" Visible="False" TabIndex="3"
CausesValidation="false" Width="646px" Enabled="False"></asp:TextBox><asp:RequiredFieldValidator
ID="rfvReason" runat="server" CssClass="requiredStar" ErrorMessage="<br /> - Please provide a reason to submit a proposal who's start date is before Today's date."
ControlToValidate="tbComment">* </asp:RequiredFieldValidator>
</td>
</tr>