• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

make array of hidden fields

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

thanks for giving time.

now i have a table of coding given below.this given code for add row in the table.first column name is callernumber.and i pass hidden parameter with this column to get "callernuber" value given by the jsp text box.
text value ="document.timestatusForm.callernumber.value "
and i get this hidden value from servlet.u can see in the code.

in jsp page one add row button and save button.
when user click on add row button, row will be added with given input.
this works fine.user can add many rows with input.

after user press save button,servlet is called and get hidden value.
but i get only last value of row.i want to get all values of all rows.
it should be work using making array of hidden parameter.
but i dont know.

please give some advise.
------------------------------------------------
this code for add row in the table with input.

function addrows(cid){
var rowsAdded = 0;
var tbody = document.getElementById(cid).getElementsByTagName("TBODY")[0];
rows = tbody.getElementsByTagName("TR");
len = rows.length;
var row = document.createElement("TR");

var t1 = document.createElement("TD");
------------------------------------
t1.innerHTML=document.timestatusForm.callernumber.value
+ '<input type="hidden" name="callernumber" value=' +
document.timestatusForm.callernumber.value + '> ';
--------------------------------------------

var t2 = document.createElement("TD");
if (document.timestatusForm.status[0].checked == true )
{
t2.innerHTML='Busy'
}
else if (document.timestatusForm.status[1].checked == true )
{
t2.innerHTML='Drop'
}
else if (document.timestatusForm.status[2].checked == true )
{
t2.innerHTML='Forward'
}

var t3 = document.createElement("TD");

t3.innerHTML=document.timestatusForm.fromdate.value + document.timestatusForm.fromtime.value

var t4 = document.createElement("TD");

t4.innerHTML=document.timestatusForm.todate.value + " " + document.timestatusForm.totime.value

var t5 = document.createElement("TD");

t5.innerHTML='<a href="#"> Delete </a>'


row.appendChild(t1)
row.appendChild(t2)
row.appendChild(t3)
row.appendChild(t4)
row.appendChild(t5)
tbody.appendChild(row)
rowsAdded++;
}
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just checking, you are using request.getParameterValues("callernumber") in the servlet, right?

-Yuriy
 
Nimish Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Thanks for giving ur valuable time.
yes i m using this.
following code of servlet.
--------------------------------------------------------------
String arr[] = request.getParameterValues("callernumber");
System.out.println("arr"+arr.length);
-----------------------------------------------------
but every time i get value of arr.length=1.
no increase lengh.i m very confuse.

please give me some advise.

thanks & regards,
nimish
 
reply
    Bookmark Topic Watch Topic
  • New Topic