Hi All,
I am using the following code in which i am creating some textboxes and and as the for loop continues the name of the textboxes will also be unique for all the textboxes.
now i want to store the textbox values into some array and want to pass the array as an value of hidden variable
I am using the following js in my Jsp to retrieve the value of hidden variable .. but it is not working :( it is giving me the error like hidden variable value is null .
any help will be appriciated.
Thanks !
I am using the following code in which i am creating some textboxes and and as the for loop continues the name of the textboxes will also be unique for all the textboxes.
now i want to store the textbox values into some array and want to pass the array as an value of hidden variable
Code:
<%
int i =0;
String[] arr_TextValues = new String[10];
String[] arr_ChkValues = new String[10];
String[] TextVal = new String[10];
for (i=0; i<user_ArrLen; i++ )
{
arr_TextValues[i] = "Text"+i;
arr_ChkValues[i] = "Chk"+i;
TextVal[i] = "hidden"+i;
%>
<td><input type=text name=<%=arr_TextValues[i]%> value=""/>
<td><input type="checkbox" name=<%=arr_ChkValues[i]%> VALUE="0" align ="center" ></td>
<td><input type=hidden name=<%=TextVal value[i]%>value="0"></td>
<%
}
%>
Code:
<script language=javascript>
function check()
{
no_of_row = document.form1.dev.value
names_array = new Array(no_of_row);
for(l=0;l<no_of_row;l++)
{
var txt="Text"+l;
var chk="Chk"+l;
var hid="Hid"+l;
if(document.form1.elements[chk].checked)
{
names_array[l]= document.form1.elenents[hid].value;
var v = document.form1.elements[txt].value;
alert(names_array[l]);
//form1.submit();
//return true;
}
else
{
alert('Please check the assign token');
return false;
}
}
}
</script>
Thanks !
Comment