Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4335
  • Last Modified:

jquery dialog with jsp include

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
Gangadhara Melukote
Asked:
Gangadhara Melukote
1 Solution
 
MrunalCommented:
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
 
Gangadhara MelukoteAuthor Commented:
Thanks. This worked good!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now