?
Solved

jquery dialog with jsp include

Posted on 2013-01-28
2
Medium Priority
?
4,270 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
This article discusses how to create an extensible mechanism for linked drop downs.
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

719 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