TechFundu

  • Increase font size
  • Default font size
  • Decrease font size
Welcome Guest,  Login | Join Now
Home Forum

Posting values from pop-up window back to parent window one by one with comma separation
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Posting values from pop-up window back to parent window one by one with comma separation
#4
Posting values from pop-up window back to parent window one by one with comma separation 2 Years, 9 Months ago Karma: 0
Hi,
I am populating one popup window value to the parent window but my requirement is to populate times and again to the same field with comma separated values. What happens now is after populating one value to my parent window when i again open the popup and select a diff value , my previous value is getting replaced by second value. I want whenever i select any other value it should be appended with the first value by a comma.
Any help will be appreciated .

My Parent window javascript code is :

function searchEmployees(){
var path = '<%=request.getContextPath() %>/secure/employeeForm.do';
var sepwin = window.open(path,'Employee_Code_Finder', 'height=600,width=600,status=1,scrollbars=yes,resizable=yes');
sepwin.moveTo(((screen.availWidth/2)-(50)), ((screen.availHeight/2)-(300)));
sepwin.focus();

}

My popup window javaScript code is :

function selectCode(code) {
window.opener.document.useForceReportForm.employee_id.value = code;
alert("empid is " + code + " selected.");
window.close();

}
deepa
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#5
Re:Posting values from pop-up window back to parent window one by one with comma separation 2 Years, 9 Months ago Karma: 0
Hi deepa,
I had the same issue. Here goes the solution.

In the popup window modify your selectCode() method like below:

function selectCode(code) {

if(window.opener.document.useForceReportForm.employee_id.value == "") {
window.opener.document.useForceReportForm.employee_id.value = code;
}
else {
window.opener.document.useForceReportForm.employee_id.value = window.opener.document.useForceReportForm.employee_id.value +","+ code;
}

window.close();

}
roselin
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
get the latest posts directly to your desktop
Follow us on Twitter