bublathejuggla
Technical User
hi all.
got a major prob.
im using JSPS embedded in HTML to retrieve all 'user profiles' from a database. user profiles comprise of 'first_name', 'last_name' and 'user_type' attributes. the profiles are retrieved and placed row-by-row in separate cells in a HTML table of inputs (the reason for using HTML inputs is because the page is supposed to allow the user to change attribute values). when the page loads, current database attribute values of each user profile are shown in each cell (input text field).
the creation of each row in the HTML table is done dynamically using a java 'for' loop that checks it has retrieved ALL database entries. i have successfully implemented in the for loop, unique names for each row input field.
heres the prob:
the HTML table is part of a HTML form, and on submission ('onSubmit'), i want to use JavaScript to check the HTML table entries for database integrity i.e. no fields are empty. This is because, changes made to the user profiles will be updated to the system database. i have been able to pass to JavaScript, the length of the table using a java variable and now wish to use a 'for' loop in JavaScript for the checking. BUT, despite having unique names for each row's input fields, how can i perform these checks? please help!
heres the JavaScript check() method im using:
function check(no_of_user_profiles) {
for(i = 0; i < no_of_user_profiles; i++) {
if(document.formName.???????.value == ""
{
alert('Missing Entry');
}
}
}
the ??????s represent the unique name of the HTML input field im checking. for example, for the first row, the ?????? would be 'USERNAME1', for the second it would be 'USERNAME2', and so on...................
got a major prob.
im using JSPS embedded in HTML to retrieve all 'user profiles' from a database. user profiles comprise of 'first_name', 'last_name' and 'user_type' attributes. the profiles are retrieved and placed row-by-row in separate cells in a HTML table of inputs (the reason for using HTML inputs is because the page is supposed to allow the user to change attribute values). when the page loads, current database attribute values of each user profile are shown in each cell (input text field).
the creation of each row in the HTML table is done dynamically using a java 'for' loop that checks it has retrieved ALL database entries. i have successfully implemented in the for loop, unique names for each row input field.
heres the prob:
the HTML table is part of a HTML form, and on submission ('onSubmit'), i want to use JavaScript to check the HTML table entries for database integrity i.e. no fields are empty. This is because, changes made to the user profiles will be updated to the system database. i have been able to pass to JavaScript, the length of the table using a java variable and now wish to use a 'for' loop in JavaScript for the checking. BUT, despite having unique names for each row's input fields, how can i perform these checks? please help!
heres the JavaScript check() method im using:
function check(no_of_user_profiles) {
for(i = 0; i < no_of_user_profiles; i++) {
if(document.formName.???????.value == ""
alert('Missing Entry');
}
}
}
the ??????s represent the unique name of the HTML input field im checking. for example, for the first row, the ?????? would be 'USERNAME1', for the second it would be 'USERNAME2', and so on...................