PDA

View Full Version : passing form object to modal dialog



yuva69
03-13-2009, 08:43 AM
1) Script Title: passing form object to modal dialog

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm

3) Describe problem:
I am quite new to this dhtmlmodal stuff and am happy to find quite a lot of ui features that I required.

I would like to pass a form object to a jsp and the resulting jsp should display all the data that was passed to it as an object. Could you pl help me.

I used the following code, and the same opens up an empty dialog box. No data is displayed in the jsp. Earlier I used ShowModalDialog and there I was getting the form object processed and the data displayed in a table. I am looking for a similar way to display the same.

ajaxwin=dhtmlwindow.open('contactus', 'contact', 'popup.jsp', 'Contact Us', 'width=650px,height=400px,left=300px,top=100px,resize=0,scrolling=1');

The popup.jsp should display table of data with coloumns and rows as retrieved from the database.

Would appreciate any help/directions.

Thanks and Regards

Yuva

My sample code:

Test.jsp: this has a href and on clicking should call popup.jsp


[U]Popup.jsp[U] this should display a window with table of data retrieved from database.


<form name="example" action="layoutCtrl.jsp">
<table id="title" width="100%" height="20" cellpadding="0" cellspacing="0" style="border-width:1; ">
<tr>
<td><image id="add" img src="../../images/test/1.jpg" title="Add Note" width="15" height="15" border="0" onClick="return addNewNote('','');"/>&nbsp;</td>
<td><font color="red"><b>Manage Reminders.</b><small> You have <%=request.getAttribute("TODO_LISTCOUNT")%> reminder(s).</small></font></td>
</tr>
</table>

<hr>
<table width="100%" height="25" cellpadding="0" cellspacing="0" style="border-width:1;" valign="center">
<input type="hidden" name="userId" value=""/>
<input type="hidden" name="actionCode" value=""/>
<input type="hidden" name="todoNote" value=""/>
<input type="hidden" name="todoDate" value=""/>
<input type="hidden" name="todoId" value=""/>
<input type="hidden" name="todoStatus" value=""/>
<tr>
<td border = "0" width="15%" align="left" valign="top">
<table border="0">
<%if(request.getAttribute("TODO_LIST") != null){
int statOption=0;
ArrayList menuArray = (ArrayList) request.getAttribute("TODO_LIST");
ArrayList statusOptions = (ArrayList) request.getAttribute("STATUS_OPTIONS");
if(menuArray.size()>0){
for(int i=0;i<menuArray.size();i++){
TodoFormBean menuAccess = (TodoFormBean)menuArray.get(i);
if(statusOptions.size()>0){
for(int k=0;k<statusOptions.size();k++){
if(menuAccess.getTodoStatus().equals(statusOptions.get(k))){
statOption=++k;
}
}
}
String todoNote=menuAccess.getTodoNotes();
if(todoNote.length()>50) todoNote=todoNote.substring(0,50);
if(i%2 == 0){
%>
<tr bgcolor = "orange" onClick="HighLightTR(this,'#c9cc99','cc3333'); setdivvisibility('<%=menuAccess.getTodoId()%>','<%=menuAccess.getTodoNotes()%>','<%=menuAccess.getTodoDate()%>','<%=statOption%>');">
<%}else{ %>
<tr bgcolor = "#FFF1E1" onClick="HighLightTR(this,'#c9cc99','cc3333'); setdivvisibility('<%=menuAccess.getTodoId()%>','<%=menuAccess.getTodoNotes()%>','<%=menuAccess.getTodoDate()%>','<%=statOption%>');">
<%} %>
<td width="3%" valign="left"><image id="modify" img src="../../images/test/1.jpg" title="Modify Note" width="15" height="10" border="0" onClick="setdivvisibility('<%=menuAccess.getTodoId()%>','<%=menuAccess.getTodoNotes()%>','<%=menuAccess.getTodoDate()%>','<%=statOption%>');"/>&nbsp;</td>
<td nowrap width="3%" align="center" name="summaryTodoId"><%=menuAccess.getTodoId()%></td>
<td nowrap width="15%" align="left" name="summaryTodoNote"><%=todoNote%></td>
<td nowrap width="10%" align="left" name="summaryTodoDate"><%=menuAccess.getTodoDate()%></td>
<td nowrap width="10%" align="left" name="summaryTodoStatus"><%=menuAccess.getTodoStatus()%></td>
<td width="3%" valign="left"><image id="del" img src="../../images/test/31.jpg" title="Del Note" width="15" height="10" border="0" onClick="deleteReminder('<%=menuAccess.getTodoId()%>');"/>&nbsp;</td>
</tr>

<%}
}
}%>
</table>
<hr>
<div id="div1" name="div1" align="center">
<table valign="top" border="0">
<tr valign="top">
<input type="hidden" id="todoid" name="todoid" value=""/>
<td><textarea id="ta" rows="10" cols="30" onkeyup="limitText(this,200);" onkeypress="limitText(this,200);"></textarea></td>
<td><table border="0" ><tr>
<td valign="top"><input id="tdate" type="text" readonly>
<A HREF="#" onClick="cal.select(document.forms['example'].tdate,'anchor1','dd/MM/yyyy'); return false;">
<img src="../../images/orange/date.gif" alt="Calendar" width="15" height="18" border="0" NAME="anchor1" ID="anchor1">&nbsp;</A></td>
<td valign="top" ><image id="save" img src="../../images/test/1.jpg" style="visibility:hidden" alt="Add Note" width="15" height="18" border="0" onClick="SubmitDetails();"/>&nbsp;</td>
</tr>
<tr>
<td>
<select id='todostat'><option value=""><---Select---></option>
<%
if(request.getAttribute("STATUS_OPTIONS") != null){
ArrayList statusOptions2 = (ArrayList) request.getAttribute("STATUS_OPTIONS");
System.out.println("statusOptions2 size is : "+statusOptions2.size());

if(statusOptions2.size()>0){
for(int k=0;k<statusOptions2.size();k++){
%>
<option value="<%=statusOptions2.get(k)%>"><%=statusOptions2.get(k)%></option>
<%}}
%><hr><%
}%>
</select>
</td>
</tr>
</div>
</td>
</tr>
</table>
</form>