Solved

jquery dialog with jsp include

Posted on 2013-01-28
2
4,075 Views
Last Modified: 2013-02-04
Dear Experts,


This is my Main JSP.

<form name="mainPage" method="POST" target="action.do">
   <jsp:include page="subPage.jsp" ></jsp:include>
   <input type="button" onclick="openDialog()" value="Open Dialog"/>
    ...
    <input type="submit" value="SubmitPage" />
</form>
<script type="text/javascript">
  function openDialog(){
      $('#dialog').dialog("open");
  }
</script>

Open in new window


This is subPage.jsp
<div id="dialog">
  <table>
    .....
  </table>
</div>
<script type="text/javascript">
  $('#dialog').dialog({autoOpen: false});
</script>

Open in new window


During first load, all are working good. The table in 'dialog' div will be hidden till the button click in main jsp.
On submitting the form, when the page get reloads then the dialog table is appears in the page and the 'Open dialog' is not opening the popup. Is this problem due to using <jsp:include> ? Also, Please let me any alternative solutions for this.
0
Comment
Question by:Gangadhara Melukote
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Mrunal earned 500 total points
ID: 38830652
hi
For the  <table> tag inside <div id="dialog"> , add css property for display none. like this:

<table id="tbl1" style="display: none;"> ... </table>

and instead of directly adding -

<script type="text/javascript">
  $('#dialog').dialog({autoOpen: false});
</script>

do it like this:

1. Add id for dialog button:

<input id="btnDialog" type="button" onclick="openDialog()" value="Open Dialog"/>

2. $(document).ready(function(){
  $('#btnDialog').click(function(){
    $('#dialog').dialog({autoOpen: false});
  });
});

Hope this helps you.
0
 

Author Comment

by:Gangadhara Melukote
ID: 38851522
Thanks. This worked good!!
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

751 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