https://i.sstatic.net/tRYul.png
I have added several items to a column in the database, but I am unsure of how to implement an onblur function for validation for each item within a loop. For example, if the NAME
field is empty, I want to display an alert, and if the length of the NRIC
field is less than a certain length, I also want to prompt an alert message. How can I achieve this?
<script>
function fnfunction(??)
{
//I need help with implementing validation for each item
}
</script>
<%
String SQL = "SELECT * FROM TB_BS_WITH UR";
String VALUE1 = "";
String ROW_NO = "";
String COL_NO = "";
DB_Contact.makeConnection();
DB_Contact.executeQuery(SQL);
while(DB_Contact.getNextQuery())
{
VALUE1 = DB_Contact.getColumnString("VALUE1");
ROW_NO = DB_Contact.getColumnString("ROW_NO");
COL_NO = DB_Contact.getColumnString("COL_NO");
%>
<table>
<tr>
<%StringTokenizer st1=n ew StringTokenizer(VALUE1, "^"); while(st1.hasMoreTokens()){%>
<th class="fontSection">
<%=st1.nextToken() %>
</th>
<%}%>
</tr>
<%for(int i=0;i<Integer.parseInt(ROW_NO);i++){ %>
<tr>
<%for(int j=0;j<Integer.parseInt(COL_NO);j++){ %>
<td>
<input type="text"name="<%=j%>_NAME_<%=i %>" id="<%=j%>_NAME_<%=i %>" onblur="fnfunction(???)">
</td>
<%}%>
</tr>
<%}%>
</table>
<%
} DB_Contact.takeDown();
%>
Current outcome... How do I set up validation for each column? https://i.sstatic.net/tRos4.png