| Author |
clear all forms & struts
|
Chris Pat
Ranch Hand
Joined: Aug 27, 2005
Posts: 156
|
|
Hello How do I loop through and assign "" to all INPUT TYPE=text elements of all the forms on a document? I can see the document.form array, however I cant see how to set up the loop and specify only INPUT TYPE=text elements. For deployment I will do this ins Struts and use the StyleId that should free me from any naming problems, but can this be integrated with the script achieving the above tia.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Can't you just use document.formName.reset(); ? var elems = document.formName.elements; alert(elems[0].type + "|" + elems[0].value); Eric
|
 |
Chris Pat
Ranch Hand
Joined: Aug 27, 2005
Posts: 156
|
|
Hi I am trying to learn the DOM model better and I dont want to specify the exact formName. I want understand how to loop through the array of forms w/o specifying the exact number. Then loop through the html INPUT elements on the particular form specifying only the TYPE=text and assign them "". The final aspect it to deploy this in Struts, but I think I can do that with EL on the code tag. Welcome comment on any/all. tia.
Originally posted by Eric Pascarello: Can't you just use document.formName.reset(); ? var elems = document.formName.elements; alert(elems[0].type + "|" + elems[0].value); Eric
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
Originally posted by Chris Pat: The final aspect it to deploy this in Struts, but I think I can do that with EL on the code tag.
That would be acompletely different mechanism than you are talking here. Javascript executues on the client after the page is loaded, JSP executes on the server to create the HTML page to send to the client.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Chris Pat
Ranch Hand
Joined: Aug 27, 2005
Posts: 156
|
|
Hi Okay then I will have to directionlessly figure out the js. However can someone tell me now to use the bean age to get and the bean:write tag to output to as a tag in html any of ServletContext, ServletConfig,etc. tia.
Originally posted by Bear Bibeault: That would be acompletely different mechanism than you are talking here. Javascript executues on the client after the page is loaded, JSP executes on the server to create the HTML page to send to the client.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Than do not use the formName. Use the forms array var myForms = document.forms; Eric
|
 |
 |
|
|
subject: clear all forms & struts
|
|
|