두 필드의 유효성을 검사하려고합니다. 하나는 열린 시간이고 다른 하나는 가까운 시간입니다. 내 유효성 검사는 종료 시간이 "00"이외의 값을 갖고 있는지 확인해야합니다. 열린 시간은 "00"보다 큰 값을 가져야합니다.coldfusion에서 javascript로 양식 유효성 검사
내 질문은 무엇을 잘못하고있는 것입니까? 내 기능에 오류가 있어야한다는 것을 알고 있습니다.
이
내가 지금까지 쓴 검증입니다 :<script type="text/javascript">
function hoursFunction(formObject, formField, fieldValue)
{
var closeHours = document.getElementById('closeHours#CountVar#');
var openHours = document.getElementById('openHours#CountVar#');
if(closeHours != "00" && openHours == "00")
{
sfm_show_error_msg('Enter a valid opening time');
}
}
그리고 내 양식의 샘플 당신은 당신의 요소의 값을 잡기 위해 필요
<form id="hoursForm" action="physician_businessHours.cfm?docID=<cfoutput>#docid#</cfoutput>" method="post" onsubmit="hoursFunction();">
<input type="hidden" name="postitnow" value="yes">
<table border="1">
<tr>
<th>Day</th><th>Open Time</th><th>Close Time</th>
</tr>
<cfloop from="1" to="7" index="CountVar">
<cfset dayFound= 0>
<tr>
<td><cfif CountVar eq 1>Mon<cfelseif CountVar eq 2>Tues<cfelseif CountVar eq 3>Wednes<cfelseif CountVar eq 4>Thurs<cfelseif CountVar eq 5>Fri<cfelseif CountVar eq 6>Satur<cfelseif CountVar eq 7>Sun</cfif>day</td>
<cfoutput>
<td>
<select id="openHours#CountVar#" name="openHours#CountVar#">
<cfloop query="doctorHours">
<cfloop from="00" to="23" index="OpenHours">
<option value="#openHours#"<cfif TimeFormat(doctorHours.openTime,'HH') EQ OpenHours AND CountVar EQ doctorHours.day > selected="selected"</cfif>>#OpenHours#</option>
</cfloop>
</cfloop>
</select>
</td>
<td>
<select id="closeHours#CountVar#" name="closeHours#CountVar#">
<cfloop query="doctorHours">
<cfloop from="00" to="23" index="closeHours">
<option value="#closeHours#"
<cfif TimeFormat(doctorHours.closeTime,'HH') EQ closeHours AND CountVar EQ doctorHours.day > selected="selected"</cfif>>#closeHours#</option>
</cfloop>
</cfloop>
</select>
</td>
</tr>
<input type="hidden" name="Validate" onValidate="hoursFunction" message="You must select an opening hour">
<input type="submit" value="Update" id="Submit">
'
무엇이 질문입니까? – Tuan