Solved

displaying employee data in parent window from child window erasing previous data

Posted on 2006-11-15
4
281 Views
Last Modified: 2010-04-01

in the parent jsp i have Multiple Employes button and Show Employees buton;when user clicks Show Employees buton it fetches all employees data from DB and displayed in the below section;that is working fine;if user clicks Multiple Employes button it opens pop window there user can enter specific employee numbers and should be displayed in the parent window wiping out the previous data.in the pop window if user enter invalid employee numbers then  in the popup window itself we should display errors.if user enters correct data then employee details should be displayed in the parent window wiping out the previous data.

i am getting problem while displaying data in parent window when user enter employee no in child window.i am also getting probelm if user enter invalid employee numbers then   we should display errors in the popup window itself;

parent jsp
**********
<html>
    <head>
            <script>
            function popup()
            {
                        var myUrl = 'child.jsp';
                        newWin = window.open(myUrl);
            }



</script>
</head>
<BODY >
<FORM  method="post" action="">

<TABLE width=800 border="1" cellspacing="0" cellpadding="0" bordercolor="#b3b3d9">
  <TBODY>
  <TR bgColor=#ffffff>
    <TD >
   
            <TABLE width="800">
              <TR class="formdata">
          <TD  align=right >
             
                  <INPUT class="input" name='Multiple'  type="button" value='Multiple Employes' onClick = "popup();">
            
              <INPUT class="input" name='button'  type=submit value='Show Employees'>
              </TD>
            </TR>
             
        </TABLE>
        </TBODY>
      <table border="0" width="800" cellpadding="2" cellspacing="1" >
          <tr class='formdata'>
            <td>&nbsp;</td>
          </tr>
        </table>
            <table border="0" width="800" cellpadding="2" cellspacing="1" >
            <tr class='formheader' align=center>
            
                  <td> </td>
            
                  <td >Employee Number</td>
                  <td>EmployeeOrigin</td>
                  <td>EmployeeDest</td>
                  <td  width = "74">Employee Code </td>
            
                  </tr>
            
<tr class='formdata' >

<td><input type="checkbox" id="empCheck0" name="empCheck" ></td>

                  <td>KHY696
                  </td>

                  <td></td>
                  <td>DGDG</td>
                  <td>DGDG</td>
                  <td></td>
                  <td></td>
                  <td></td>
                  
            </tr>
           
<tr class='formdata' >

<td><input type="checkbox" id="empCheck1" name="empCheck"></td>

                  <td>KHY697
                  </td>
                  <td></td>
                  <td>FHFH</td>
                  <td>FHFH</td>
                  <td>KG</td>
                  
            </tr>
           

         </FORM>

   
    </body>
</html>






child.jsp
*********
 
<html>
<head>
<script>
function sendData()
{

      Url = "main.jsp";
      document.forms[0].action = Url;
      document.form1.submit();

}
 

 

</SCRIPT>
</head>
<BODY>
<form name="form1" method="post" action="" >

      <table width="800" border="1" cellspacing="0" cellpadding="0" bordercolor="#b3b3d9">
      <tr>
            <td class=formheader>
                  <table width="800" border="0" cellspacing="1" cellpadding="2">
                  <tr>
                        <td class=formlabel colspan="2">Enter Multiple Employees  for deletion</td>
                  </tr>
                  </table>
                  <table  class='formlabel' border="0" cellspacing="0" cellpadding="0" width=100%>
                  <tr>
                        <td class=formdata colspan="2">
                              <font color="red" size="2"><b>

                              </b></font>
                        </td>
                  </tr>
              </table>
                  
                  <table width="800" border="0" cellspacing="1" cellpadding="2">
                  <tr>
                  <td class=formheader align=center>Emp No<input type="text" name="empno1" value=""></td></tr>
                  <tr><td class=formheader align=center>Emp No<input type="text" name="empno2" value=""></td></tr>

                  </table>
                  <table width="800" border="0" cellspacing="1" cellpadding="2">
                        <tr class=formdata>
                        <td class=formdata align = 'right'><input type="button" value="ENTER" name="ENTER"  class='input' id="ENTER" onClick="sendData();"></td>
                        
                        </tr>
                  </table>
  </table>
</form>
</body>
</html>
0
Comment
Question by:chaitu chaitu
  • 3
4 Comments
 
LVL 5

Expert Comment

by:deeppra
ID: 17954443
send me where u have the problem
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 17954499
i am not able to hide the parent data when i entered employee number in child window.
0
 
LVL 5

Expert Comment

by:deeppra
ID: 17954626
// open a document called 'thisdoc.html'
// in a window named 'win02'
window.open('thisdoc.html', 'win02');

//to close the window
win02.close();

0
 
LVL 5

Accepted Solution

by:
deeppra earned 500 total points
ID: 17954763
in the parent window dont put every thing in a single table. split the table into two in the first table you have all the buttons and below that u have a div element like this

<div id="result">
.....
</div>

during the first time the content of the div should be empty and after the user clicks show employees button a javascript should be triggered then it should send the request to the server and when the server sends back the response the content is updated in the div element like this

//After getting the response from the server store the details in the variable say 'res'
//then update the div tag with this command
window.document.getElementById('result').innerHTML = res;

when u r accessing from the child window then use
window.parent.document.getElementById('result').innerHTML = newres;

so that the parent window will be updated with the new content available in newres variable

For accessing parent element refer this document
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_window.asp

For Sending the request to the server u can use AJAX u can find many materials in the net
check this link u have the code for calling a servlet
http://www.thescripts.com/forum/thread169178.html

for details about AJAX see http://www.activemq.org/site/ajax.html

I think this is useful

Thanks
Pradeep D
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now