Hello I have a problem to validate some fields at the same time in my form, I have a timesheet table where the rows are added by a add new row to capture time the id for this rows are random, for each row I need to validate 3 elements:

-The type of entry
-The total time of the week is more than 0
-Select type is diferent than "~EMPTY+"

at the bottom is part of the code in the form for the timesheet, so I hope you can help me to find a function that can help me validate those 3 things for each row in the form.

I only got this but only works with the first row.

function checkUVFilled()
{
for (var __k = 0; __k < document.forms.length; __k++)
{
for (var __j = 0;__j< document.forms[__k].elements.length;__j++)
{
if (document.forms[__k].elements[__j].name =="timeentry_isdirect" && document.forms[__k].elements[__j].value ==="true")
{
for (var __a = 0; __a < document.forms.length; __a++)
{
for (var __b = 0;__b< document.forms[__a].elements.length;__b++)
{
if (document.forms[__a].elements[__b].name =="timeentry_total" && document.forms[__a].elements[__b].value > 0)
{
for (var __x = 0; __x < document.forms.length; __x++)
{
for (var __z = 0;__z< document.forms[__x].elements.length;__z++)
{
if (document.forms[__x].elements[__z].name =="timeentry_lov1" && document.forms[__x].elements[__z].value !=="~EMPTY~")
{return true;}
}
}
}
}
}
}
}
}

try{
var ni = document.getElementById('pageError-page');
ni.id = 'pageError-pageUsed'
var newdiv = document.createElement('div');
var divIdName = 'bhi-message';
newdiv.setAttribute('id',divIdName);
newdiv.innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="sectionVSpace"><img src="ui/evolution2/images/Spacer.gif" width="1" height="1"></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#000000"><tr align="left"><td class="errorTitle"><img src="ui/evolution2/images/WdgError.gif" width="20" height="20" align="absmiddle" alt="Error" title="Error">&nbsp;Error</td></tr></table> <table width="100%" border="0" cellspacing="1" cellpadding="0" class="errorBorder"><tr><td class="errorText" valign="top" width="100%">COUNTRY has not been chosen for all Project Time Entries</td></tr></table>';
ni.appendChild(newdiv);
window.scrollTo(0,0);
}
catch(e){};

return false;
}

Regards,


<tr valign="top" class="total"><td class="tableContent total" scope="row" colspan="15" align="left">
<a target="" id="collapse" href="app?action=timeadmin.editTimesheet&amp;id=5091497&amp;section=direct&amp;state=collapsed"><img id="collapseimg" border="0" name="HierExpanded" alt="Collapse" title="Collapse" src="ui/evolution2/images/HierExpanded.gif" align="absmiddle"></a><img src="ui/evolution2/images/Spacer.gif" width="3" height="1" alt="">Tasks</td></tr>
<tr valign="top" class="rowOff" onMouseOver="this.className='rowOn'" onMouseOut="this.className='rowOff'">
<input type="hidden" name="timeentry_id" value="5995921">
<input type="hidden" name="timeentry_isdirect" value="true">
<input type="hidden" name="timeentry_isIncident" value="false">
<input type="hidden" name="timeentry_status" value=""><td class="tableContent" align="center">
<input type="checkbox" name="timeentry_selected" value="5995921" class="checkbox" id="d95758e130"></td>
<td class="tableContent">PR11585</td><td class="tableContent">
<a class="inlineActionLink" target="" href="app?action=projmgr.getProjectProperties&amp;id=5016547&amp;retmode=timesheet" title="2012BU: Aditivos">2012BU: Aditivos</a></td>
<td class="tableContent">
<a class="inlineActionLink" target="" href="app?action=projmgr.taskProperties&amp;id=5558202&amp;pathInfo=5558202&amp;projectId=5016547&am p;returnAction=timeadmin.editTimesheetReturn" title="2012BU: Aditivos\Aditivos">Aditivos</a></td>
<input type="hidden" name="timeentry_cc" value="">
<td class="tableContent" align="center"><a target="" id="notes" href="javascriptpenWindow('page','timeadmin.notesBrowser','medium','id=5995921','table=PRTimeEntry');"><img id="notesimg" border="0" name="IcoNotesNew" alt="Time Entry Notes" title="Time Entry Notes" src="ui/evolution2/images/IcoNotesNew.gif" align="absmiddle"></a></td><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e160" value="" size="3" maxlength="" class="formFieldNoWidth calNonWorking" alt="Sun, 4/28, 2012BU: Aditivos, Aditivos, ETC: 0.0" title="Sun, 4/28, 2012BU: Aditivos, Aditivos, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5995921">
<input type="hidden" name="actuals_day" value="0">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e171" value="5.0" size="3" maxlength="" class="formFieldNoWidth" alt="Mon, 4/29, 2012BU: Aditivos, Aditivos, ETC: 0.0" title="Mon, 4/29, 2012BU: Aditivos, Aditivos, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5995921">
<input type="hidden" name="actuals_day" value="1">
<input type="hidden" name="actuals_orig" value="5.0"><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e181" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Tue, 4/30, 2012BU: Aditivos, Aditivos, ETC: 0.0" title="Tue, 4/30, 2012BU: Aditivos, Aditivos, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5995921">
<input type="hidden" name="actuals_day" value="2">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e192" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Wed, 5/1, 2012BU: Aditivos, Aditivos, ETC: 0.0" title="Wed, 5/1, 2012BU: Aditivos, Aditivos, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5995921">
<input type="hidden" name="actuals_day" value="3">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e202" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Thu, 5/2, 2012BU: Aditivos, Aditivos, ETC: 0.0" title="Thu, 5/2, 2012BU: Aditivos, Aditivos, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5995921">
<input type="hidden" name="actuals_day" value="4">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e212" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Fri, 5/3, 2012BU: Aditivos, Aditivos, ETC: 0.0" title="Fri, 5/3, 2012BU: Aditivos, Aditivos, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5995921">
<input type="hidden" name="actuals_day" value="5">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e223" value="" size="3" maxlength="" class="formFieldNoWidth calNonWorking" alt="Sat, 5/4, 2012BU: Aditivos, Aditivos, ETC: 0.0" title="Sat, 5/4, 2012BU: Aditivos, Aditivos, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5995921">
<input type="hidden" name="actuals_day" value="6">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" width="3" align="right">
<input type="text" name="timeentry_total" id="d95758e232" value="5.0" size="3" maxlength="" class="formFieldNoWidth"></td>
<input type="hidden" name="timeentry_orig_total" value="5.0"><td class="tableContent" width="6">
<select name="timeentry_lov1" id="d95758e236" class="formFieldNoWidth"><option value="~EMPTY~">--Select--------------------------</option><option value="Mexico">Mexico</option></select>
</td></tr><tr valign="top" class="rowOff" onMouseOver="this.className='rowOn'" onMouseOut="this.className='rowOff'">
<input type="hidden" name="timeentry_id" value="5998635">
<input type="hidden" name="timeentry_isdirect" value="true">
<input type="hidden" name="timeentry_isIncident" value="false">
<input type="hidden" name="timeentry_status" value=""><td class="tableContent" align="center">
<input type="checkbox" name="timeentry_selected" value="5998635" class="checkbox" id="d95758e250"></td><td class="tableContent">PR11599</td><td class="tableContent"><a class="inlineActionLink" target="" href="app?action=projmgr.getProjectProperties&amp;id=5016557&amp;retmode=timesheet" title="2012PRO: Modelo Construrama - Piloto Costa Rica">2012PRO: Modelo Construrama - Piloto Costa Rica</a></td><td class="tableContent"><a class="inlineActionLink" target="" href="app?action=projmgr.taskProperties&amp;id=5558221&amp;pathInfo=5558221&amp;projectId=5016557&am p;returnAction=timeadmin.editTimesheetReturn" title="2012PRO: Modelo Construrama - Piloto Costa Rica\Modelo Construrama - Piloto Costa Rica">Modelo Construrama - Piloto Costa Rica</a></td>
<input type="hidden" name="timeentry_cc" value=""><td class="tableContent" align="center"><a target="" id="notes" href="javascriptpenWindow('page','timeadmin.notesBrowser','medium','id=5998635','table=PRTimeEntry');"><img id="notesimg" border="0" name="IcoNotesNew" alt="Time Entry Notes" title="Time Entry Notes" src="ui/evolution2/images/IcoNotesNew.gif" align="absmiddle"></a></td><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e280" value="" size="3" maxlength="" class="formFieldNoWidth calNonWorking" alt="Sun, 4/28, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0" title="Sun, 4/28, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998635"><input type="hidden" name="actuals_day" value="0">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e291" value="2.0" size="3" maxlength="" class="formFieldNoWidth" alt="Mon, 4/29, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0" title="Mon, 4/29, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998635">
<input type="hidden" name="actuals_day" value="1">
<input type="hidden" name="actuals_orig" value="2.0"><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e301" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Tue, 4/30, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0" title="Tue, 4/30, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998635">
<input type="hidden" name="actuals_day" value="2">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e312" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Wed, 5/1, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0" title="Wed, 5/1, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998635">
<input type="hidden" name="actuals_day" value="3">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e322" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Thu, 5/2, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0" title="Thu, 5/2, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998635">
<input type="hidden" name="actuals_day" value="4">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e332" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Fri, 5/3, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0" title="Fri, 5/3, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998635">
<input type="hidden" name="actuals_day" value="5">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e343" value="" size="3" maxlength="" class="formFieldNoWidth calNonWorking" alt="Sat, 5/4, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0" title="Sat, 5/4, 2012PRO: Modelo Construrama - Piloto Costa Rica, Modelo Construrama - Piloto Costa Rica, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998635">
<input type="hidden" name="actuals_day" value="6">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" width="3" align="right">
<input type="text" name="timeentry_total" id="d95758e352" value="2.0" size="3" maxlength="" class="formFieldNoWidth"></td>
<input type="hidden" name="timeentry_orig_total" value="2.0"><td class="tableContent" width="6">
<select name="timeentry_lov1" id="d95758e356" class="formFieldNoWidth"><option value="~EMPTY~">--Select--------------------------</option><option value="Costa Rica">Costa Rica</option></select>
</td></tr><tr valign="top" class="rowOff" onMouseOver="this.className='rowOn'" onMouseOut="this.className='rowOff'">
<input type="hidden" name="timeentry_id" value="5998633">
<input type="hidden" name="timeentry_isdirect" value="true">
<input type="hidden" name="timeentry_isIncident" value="false">
<input type="hidden" name="timeentry_status" value=""><td class="tableContent" align="center">
<input type="checkbox" name="timeentry_selected" value="5998633" class="checkbox" id="d95758e370"></td><td class="tableContent">PR11119</td><td class="tableContent"><a class="inlineActionLink" target="" href="app?action=projmgr.getProjectProperties&amp;id=5015115&amp;retmode=timesheet" title="P&amp;IT Service Catalogue: Internal Activities">P&amp;IT Service Catalogue: Internal Activities</a></td><td class="tableContent"><a class="inlineActionLink" target="" href="app?action=projmgr.taskProperties&amp;id=5555994&amp;pathInfo=5555994&amp;projectId=5015115&am p;returnAction=timeadmin.editTimesheetReturn" title="P&amp;IT Service Catalogue: Internal Activities\Support to Internal VPP Customers">Support to Internal VPP Customers</a></td>
<input type="hidden" name="timeentry_cc" value=""><td class="tableContent" align="center"><a target="" id="notes" href="javascriptpenWindow('page','timeadmin.notesBrowser','medium','id=5998633','table=PRTimeEntry');"><img id="notesimg" border="0" name="IcoNotesNew" alt="Time Entry Notes" title="Time Entry Notes" src="ui/evolution2/images/IcoNotesNew.gif" align="absmiddle"></a></td><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e400" value="" size="3" maxlength="" class="formFieldNoWidth calNonWorking" alt="Sun, 4/28, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0" title="Sun, 4/28, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998633">
<input type="hidden" name="actuals_day" value="0">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e411" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Mon, 4/29, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0" title="Mon, 4/29, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998633">
<input type="hidden" name="actuals_day" value="1">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e421" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Tue, 4/30, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0" title="Tue, 4/30, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998633">
<input type="hidden" name="actuals_day" value="2">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e432" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Wed, 5/1, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0" title="Wed, 5/1, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998633">
<input type="hidden" name="actuals_day" value="3">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e442" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Thu, 5/2, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0" title="Thu, 5/2, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998633">
<input type="hidden" name="actuals_day" value="4">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e452" value="" size="3" maxlength="" class="formFieldNoWidth" alt="Fri, 5/3, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0" title="Fri, 5/3, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998633">
<input type="hidden" name="actuals_day" value="5">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" align="right">
<input type="text" name="actuals_hours" id="d95758e463" value="" size="3" maxlength="" class="formFieldNoWidth calNonWorking" alt="Sat, 5/4, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0" title="Sat, 5/4, P&amp;IT Service Catalogue: Internal Activities, Support to Internal VPP Customers, ETC: 0.0"></td>
<input type="hidden" name="actuals_id" value="5998633">
<input type="hidden" name="actuals_day" value="6">
<input type="hidden" name="actuals_orig" value=""><td class="tableContent" width="3" align="right">
<input type="text" name="timeentry_total" id="d95758e472" value="0.0" size="3" maxlength="" class="formFieldNoWidth"></td>
<input type="hidden" name="timeentry_orig_total" value="0.0"><td class="tableContent" width="6">
<select name="timeentry_lov1" id="d95758e476" class="formFieldNoWidth"><option value="~EMPTY~">--Select--------------------------</option><option value="CORPORATE (EVP FA,OHR,SPBD)">CORPORATE (EVP FA,OHR,SPBD)</option></select>
</td></tr><tr valign="top" class="total"><td class="tableContent total" scope="row">