scripter50
IS-IT--Management
I have an ASP page generating html code like this...
<%for i = 1 to nNbrOfDays%>
<table>
<tr>
<td>Day <%=i%> <input type="text" name="txtDate<%=i%>">td>
<td><select name="cboService<%=i%>" style="width:120" onchange="fnPopVisits<%=i%>();">
<option value="0">No Service</option>
<option value="1">Daily Visits</option>
<option value="2">Live-In</option>
</select>
</td>
etc...etc...
<% next %>
<input type="submit" name="btnSubmit" value="Proceed" onclick = "return fnValidate();"> ....
I'm trying to do an edit check with javascript to prevent empty fields..
<javascript>
funtion fnValidate() {
var nbrofdays = document.frmNewReservation.hdnNbrOfDays.value;
for (i = 1; i<=nbrofdays; i++) {
if (document.frmNewReservation.txtDate.value =="") {
alert("Enter value..");
return false;
}
}
</script>
I am not able to access the form element this way, "txtDate" is not available??? Any ideas?
Thanks in advance,
scripter50
<%for i = 1 to nNbrOfDays%>
<table>
<tr>
<td>Day <%=i%> <input type="text" name="txtDate<%=i%>">td>
<td><select name="cboService<%=i%>" style="width:120" onchange="fnPopVisits<%=i%>();">
<option value="0">No Service</option>
<option value="1">Daily Visits</option>
<option value="2">Live-In</option>
</select>
</td>
etc...etc...
<% next %>
<input type="submit" name="btnSubmit" value="Proceed" onclick = "return fnValidate();"> ....
I'm trying to do an edit check with javascript to prevent empty fields..
<javascript>
funtion fnValidate() {
var nbrofdays = document.frmNewReservation.hdnNbrOfDays.value;
for (i = 1; i<=nbrofdays; i++) {
if (document.frmNewReservation.txtDate.value =="") {
alert("Enter value..");
return false;
}
}
</script>
I am not able to access the form element this way, "txtDate" is not available??? Any ideas?
Thanks in advance,
scripter50