Save and close the child window, and refresh the parent window.

Source: Internet
Author: User

 

From iteye blog http://pingchajava.iteye.com/blog/913973

Problem description:

 

On the child page, when the modified vertex is saved, save the data, close the data, and refresh the parent page to display the modified data.

 

1. on the parent page: the code of the subwindow is displayed when you click Modify (window. showmodaldialog is used to allow users to click this change to respond to other tasks ):

JS Code
  1. // The second parameter in the showmodaldialog form, which is the object of the current form
  2. <A href = "#" onclick = "window. showmodaldialog ('userupdate. do? Userid = <% = lo_dt.uf_getvalue (I, 0) %> ', window, 'dialogwidth: 480px; dialogheight: 180px; Status: No;') "> modify </a>
// The second parameter in the showmodaldialog form, which is the current form object <a href = "#" onclick = "window. showmodaldialog ('userupdate. do? Userid = <% = lo_dt.uf_getvalue (I, 0) %> ', window, 'dialogwidth: 480px; dialogheight: 180px; Status: No;') "> modify </a>

 

2. Save the changes in the Child Window and refresh the parent window:

1) Submit the current subpage to IFRAME during submission

HTML code
  1. // At this time, the form is submitted to IFRAME, and IFRAME is implicit.
  2. <IFRAME name = "commitarea" style = 'display: none; '> </iframe>
  3. <Form action = "usersave. Do" method = "Post" target = "commitarea">
  4. <Input type = "button" value = "save" class = "button" onclick = "check ();">
  5. </Form>
// At this time, the form is submitted to IFRAME. IFRAME is implicitly <IFRAME name = "commitarea" style = 'display: none; '> </iframe> <form action = "usersave. do "method =" Post "target =" commitarea "> <input type =" button "value =" save "class =" button "onclick =" check (); "> </form>

 

2) submit the form to an action.

Java code
  1. // Add the following statement to the submitted action method:
  2. Request. setattribute ("updateuserok", "modified ");
// Add the following statement request. setattribute ("updateuserok", "modified successfully") to the submitted action method ");

And forward it to the current subpage

 

3) Close the child page and refresh the parent page

JS Code
  1. <Logic: present name = "updateuserok">
  2. <SCRIPT>
  3. Alert ("saved successfully! ");
  4. // Dialogarguments is an object transmitted from the parent form.
  5. Window. dialogarguments. Window. Location = "user. Do ";
  6. Self. Close ();
  7. </SCRIPT>
  8. </Logic: Present>
<Logic: present name = "updateuserok"> <SCRIPT> alert ("saved successfully! "); // Dialogarguments is the object window passed by the parent form. dialogarguments. window. location = "user. do "; self. close (); </SCRIPT> </logic: Present>

 

At this time, the user. Do enters the database search and jumps to the parent page.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.