Web tier: servlets, JSP, Web frameworks: validatons for dynamically created page
- Posted by: uday garikapati
- Posted on: July 20 2004 01:57 EDT
i got a problem in my web application. i have a JSP page with table. it contains one header row which comes from the database(i.e i take the values of that header from DB and put them in a string Tokenizer and display) and under that the respective Textboxes to enter the data for them.
here i can add any no of ROWs by clicking some button. all this adding of rows i have written in Java Script.
now i got the problem that, i have to write code for Validations for all these fields! i can do that all for the initial row becas it have specific names for them. but for dynamically created rows, all the text boxes in that row having same name. so how can i validate them seperaterly becas they contain different types of data.
pl help me in this regard.
i can do that all for the initial row becas it have specific names for them. but for dynamically created rows, all the text boxes in that row having same name.Hi Uday,
so why don't you name the generated fields i.e. name_1, name_2, etc. or in any other way which whould leave you full control over what value should be expected unter given name?
If you do so, the rest should be easy.
You dont have to name them name_1, name_2
You can acess them through an array, from the document, form objects and index through them using afor loop. I just dont remember how. Google can always help lol