| Author |
writing contents to a text area or hidden field
|
Sri Sar
Ranch Hand
Joined: Mar 25, 2004
Posts: 44
|
|
Hi, using Javascript functions, i have created a set of XML tags that are generated on a new window. ie in my form, the user makes his selection using the select tags. once these selections are made, using an appropriate function, i create a set of XML tags that are generated in a new window. the XML tags are as below: <user> <pic>C:\My Documents\abc.jpg</pic> <tex>C:\My Documents\dat.txt</tex> </user> now i want to submit these tags to a server side program ie a servlet/JSP. i feel i can write that XML to a form field (say, a textarea, or a hidden field) and then submit that. but i am not sure how to proceed. how can i write the above XML onto a textarea or hidden field. it will quite helpful to me if u can help with some sample code, thanks in advance,
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
You can add information to text area, hidden element, or text field by setting the value. document.FormName.ElementName.value = "blah"; You may also want to look into escaping the string. escape() Not sure that is what you are asking, but that is what I can come up with after writing all night and about to go to bed. Eric
|
 |
Sri Sar
Ranch Hand
Joined: Mar 25, 2004
Posts: 44
|
|
Hi eric, i will try to make my problem clearer: 1) by using a form, the user selects options like an image, a text file etc 2) in the same form, i use a javascript function that geneates an XML like structure representing the values chosen by the user( say the user has chosen an image abc.jpg and a text file dat.txt). after the user has chosen his selections and clicks on an appropriate button, a new window opens. 3) this window contains XML tags that denote the files chosen by the user: <user> <pic>C:\My Documents\abc.jpg</pic> <tex>C:\My Documents\dat.txt</tex> </user> 4) now i want these XML tags to be written into a hidden field so that when the user clicks on the submit button, a server-side program on the server can get these tags. my query is that how can i include all the tags into a hidden field?? hope i have made the question clear.
|
 |
Gjorgi Var
Ranch Hand
Joined: Feb 24, 2004
Posts: 85
|
|
The way you described it, I hope following can help: You could write another function that would ask the user for a confirmation of the choices made with a "proceed" button that when clicked would send the choices to the server in a separate file... instead of opening a new window for the confirmation for example...
|
 |
 |
|
|
subject: writing contents to a text area or hidden field
|
|
|