PDA

View Full Version : Passing Dynamic elements to JSP


John Drew
09-25-2002, 06:28 AM
All,

I have JSP page with a JavaScript function to create a new row in a table.
When I submit this to my next page, I am attempting to get the rows the
user added from the request string, and they are not there.

Is there any way to get the dynamically generated rows in the request
string?

Thanks,
JD

glenngv
09-25-2002, 06:48 AM
do you create html elements inside the row? if there are elements like textbox, you can access its value when submitted in the server even if it is dynamically created.

well, you can post your code or links so that we can see what you are actually creating dynamically.

John Drew
09-25-2002, 04:10 PM
glenngv,

Attached is the section of code in question. I am generating the first row of the table with JSP. When the user clicks a button, it clones the nodes of the first row, and creates the next row. When I submit the form tot the next JSP, I can not capture any of the added rows. They are all standard HTML elements, so I can't figure the problem.

Thanks,
JD

glenngv
09-26-2002, 04:09 AM
i noticed that your select tags don't have any values:

<select name="cbo_TIRKS_FrameType0">
<option>T</option>
<option>J</option>
</select>

the option tags should have value attribute because this is the value retrieve by the server when the page is submitted, not the text in between them.

regarding cloning nodes, not sure of it though.
well in IE, you can see the html code dynamically created by javascript.

i got this trick from Dave Clark, also a member of this forum but i haven't heard of him for so long now...

just type this a the address bar:

javascript:var myWin=window.open("","","width=800,height=600,scrollbars,resizable,menubar");var myStr=document.documentElement.outerHTML;myStr=myStr.replace(/\</g,"&lt;").replace(/\>/g,"&gt;").replace(/\r\n/g,"<br>");myWin.document.open();myWin.document.write(myStr);myWin.document.close();

or you can add it to Favorites.
Im sure this will help a lot in Web programming. :)