Display values of one JSP to a popup JSP Window
Hi there,
I have a JSP page on which I have a button and a hidden field. onclickevent of button I am calling a function (written in Javascrip) is storing values of selected names(from Dropbox by user). So my hiiden field Selected_names.values contains all the names (seperated by coma) selscted by user, now when User click Update button I have poped up a JSP window where I want to display List of those selected_names.value in text mode where user can Edit those names.
Could anyone please help me with sample code? I will really appreciate it.
So I need help to display a list of selected names in popup jsp window. And then edit it
i am new to JSP , so don't have much idea
Thanks
[723 byte] By [
ASH_2007a] at [2007-11-27 7:33:22]

# 1
Hi,
To open a new window, you need to use JavaScript: window.open(). Look up this method. There are others also, but they're browser specific so you can see which one suits you.
There's still the problem of passing the parameters to the newly opened page; I can't think of a way right now. You could try putting the values of selected_names as part of the URL to open ( one of the parameters of window.open() ) and then receive them in the JSP page which will open.
# 2
I know, how to open a window, but displaying the values from one jsp to other jsp seems difficlut.
In other case, If I just want to display the selected names on the same page (but In a text mode) so I can update them,how can I do that?
I mean textarea is not suitable ,I want something which is similar to dropbox but where options are like text field so you can update them
You what I am saying,
I hope I am not confusing you..
And suggestions?
Thanks
# 3
Since you are doing it in javascript you could always fake the new window.
1. Put a hidden div tag on your screen.
2. Then in javascript create x input fields in the div tag (1 for each value in the drop down)
3. Make the div tag visible.
4. The user could then edit the input fields.
5. User clicks a save button.
6. Fire a javascript method to repopulate the drop down.
Message was edited by:
gmachamer
and hide the div tag again.
# 4
Thanks you for response.Can you please explain with sample code?I am not followingThanks
# 5
put something like this on your jsp
<div id="comboChangeDialog" style="visibility:hidden;">
<table><tr><td></td></tr></table>
</div>
You would need to assign an ID to your table and then use some getelementbytagname or something to get what cell you want to add the input field to.
Then in your javascript something like this
var el = document.createElement('input');
var counter = 1;
el.setAttribute('type', 'text');
el.setAttribute('name','comboChg'+counter);
el.setAttribute('value', 'X'); //get the first value from thedrop down.
cell.appendChild(el);
Then
showHideElement = document.getElementById('comboChangeDialog');
showHideElement.style.visibility="visible";
after that pull the values out with javascript and change the style.visible to hidden.
The hidden div tag will not stay visible over drop downs in some browsers, I can append some code that I wrote that takes care of this if need be.
I don't have code that does exactly what you want, so this was just a quick and ugly copy paste modify ...
# 6
HI Thanks so much for the help.But I am not sure How to display values in div tag.I mean Do I need to get all values in one string ?I am still working on it, I haven't got it worked yet.I wasn't sure about div,like how I am goona implement itThanks
# 7
By display in Div tag I mean you would get the values in javascript and then dynamically add input fields to the table inside the div tag.. after adding two input field you would have something like this... You would have to pull each selected value out of the drop down individually
<div><table><tr><td><input></td></tr><tr><td><input></td></tr></table></div>