I am using struts1. Can anyone guild how to solve this problem.
Thanks On Mon, Aug 6, 2012 at 4:36 PM, Arpan <arpan.deb...@gmail.com> wrote: > Hi All, > > I have a requirement where I am creating hidden input elements and > submitting the form. > > I have a list of objects and my hidden elements "name" attribute should be > as such that all the hidden element values will be set into the list of > objects. > > So I am creating hidden elements like following way : > > In my form I am setting connectionBeans collection like this - > > public void setConnectionBeans(List<ConnectionBean> connectionBeans) { > this.connectionBeans = connectionBeans; > } > > ConnectionBean has setName and getName methods. > > *And in JS:* > i =0; > start loop -- > var name= 'connectionBeans[' + i + '].name'; > > createHiddenElement(theForm,host,value,'id'); > i++; > end loop --- > > function createHiddenElement(form,name,value, id){ > var input = document.createElement("input"); > > input.setAttribute("type", "hidden"); > input.setAttribute("name", name); > input.setAttribute("id",id); > input.setAttribute("value", value); > document.getElementById("hiddendiv").appendChild(input); > return false; > } > > I am able to create the hidden elements, but the form is not able to > submit and gives error. > I am thinking that the "name" attribute of these generated input hidden > elements are not correct. > > Anyone have any idea? > > > Thanks > >