I have a form with a selection box and would like to replace the completion date based on the selection "Closed" with the current date.
Here is the form:
<form name="EditForm" action="<%=m_action%>" method="post">
<tr>
<td>Initiated by</td><td><input name="InitiatedBy" type="text" value="<%=rs("InitiatedBy")%>" size="30">
Initated on <input name="Initiated" type="text" value="<%=rs("Initiated")%>" size="10"><INPUT TYPE="image" SRC="images/cal.gif" HEIGHT="19" WIDTH="19" BORDER="0" onclick="return showCalendar('Initiated', '%m/%d/%Y');">
Target Due Date <input name="TargetDueDate" type="text" value="<%=rs("TargetDueDate")%>" size="10"><INPUT TYPE="image" SRC="images/cal.gif" HEIGHT="19" WIDTH="19" BORDER="0" onclick="return showCalendar('TargetDueDate', '%m/%d/%Y');">
Completion Date <input name="CompletionDate" type="text" value="<%=rs("CompletionDate")%>" size="10"><INPUT TYPE="image" SRC="images/cal.gif" HEIGHT="19" WIDTH="19" BORDER="0" onclick="return showCalendar('CompletionDate', '%m/%d/%Y');"></td>
</tr>
<td>Issue Type</td><td><select name="Resolved" type="text" value="" size="1" onchange="doSelect(this);"><option value="New">New</option>
<option value="Open">Open</option>
<option value="Pending">Pending</option>
<option value="Closed">Closed</option>
<option value="Resolved">Resolved</option>
</select>
</td>
</tr>
<tr>
<td colspan="6">
<input type="submit" value="Save" onclick="this.disabled=true;this.value='Saving...';
this.form.submit();"><input type="button" value="Cancel" onClick="history.go(-1)">
</td>
</tr>
</form>
Here is the function:
<script type="text/javascript">
function doSelect(x)
{
if(x.options[x.selectedIndex].value="Closed")
{
document.EditForm.CompletionDate.value=(now.getDate() + "/" + now.getMonth() + "/" + now.getYear())
}
else
{
document.EditForm.CompletionDate=" "
}
</script>
This unfortunetly does not work, what do I do wrong in the function?
Your input is highly appreciated
Here is the form:
<form name="EditForm" action="<%=m_action%>" method="post">
<tr>
<td>Initiated by</td><td><input name="InitiatedBy" type="text" value="<%=rs("InitiatedBy")%>" size="30">
Initated on <input name="Initiated" type="text" value="<%=rs("Initiated")%>" size="10"><INPUT TYPE="image" SRC="images/cal.gif" HEIGHT="19" WIDTH="19" BORDER="0" onclick="return showCalendar('Initiated', '%m/%d/%Y');">
Target Due Date <input name="TargetDueDate" type="text" value="<%=rs("TargetDueDate")%>" size="10"><INPUT TYPE="image" SRC="images/cal.gif" HEIGHT="19" WIDTH="19" BORDER="0" onclick="return showCalendar('TargetDueDate', '%m/%d/%Y');">
Completion Date <input name="CompletionDate" type="text" value="<%=rs("CompletionDate")%>" size="10"><INPUT TYPE="image" SRC="images/cal.gif" HEIGHT="19" WIDTH="19" BORDER="0" onclick="return showCalendar('CompletionDate', '%m/%d/%Y');"></td>
</tr>
<td>Issue Type</td><td><select name="Resolved" type="text" value="" size="1" onchange="doSelect(this);"><option value="New">New</option>
<option value="Open">Open</option>
<option value="Pending">Pending</option>
<option value="Closed">Closed</option>
<option value="Resolved">Resolved</option>
</select>
</td>
</tr>
<tr>
<td colspan="6">
<input type="submit" value="Save" onclick="this.disabled=true;this.value='Saving...';
this.form.submit();"><input type="button" value="Cancel" onClick="history.go(-1)">
</td>
</tr>
</form>
Here is the function:
<script type="text/javascript">
function doSelect(x)
{
if(x.options[x.selectedIndex].value="Closed")
{
document.EditForm.CompletionDate.value=(now.getDate() + "/" + now.getMonth() + "/" + now.getYear())
}
else
{
document.EditForm.CompletionDate=" "
}
</script>
This unfortunetly does not work, what do I do wrong in the function?
Your input is highly appreciated