Question : Jquery ui modal and using form in the pop up window.

Hello experts.
This is a part 2 question as  the next step from here:http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_26336809.html
where i open a pop up window and checking some checkboxes get the values in a textarea.

Now i have a problem in my page in the pop up window.Because it is a page that is loading results from a query i want to filter these results using forms in there.The problem is of course that the pop up window disappears and a new window opens when a form is been submitting.

Any help?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
<!-- jquery staff --->
<form name="insertform" id="insertform">
<fieldset>
<div style="display:inline; float:left;"><label  for="images">images</label>
<textarea  name="images"  cols="30" rows="5" wrap="virtual"    id="images"></textarea> 
</div>
<div style="display:inline; float:left"><a href="#" id="dialog_link" class="ui-state-default ui-corner-all">choose images</a></div>
</fieldset>
</form>
<div id="dialogimg" title="images"></div>
<script language="javascript">
$(function(){$('#dialogimg').dialog({
	 autoOpen:false,
	 bgiframe:true,
	 modal:false,
	 width:800,
	 height:600,
	 buttons:{"OK":function(){
		 $(this).dialog("close");},
		 "Cancel":function(){
			 $(this).dialog("close");
			 }}});
	$('#dialog_link').click(function(){
	$('#dialogimg').dialog('open'); 
	$('#dialogimg').load("ajax/getallimages.cfm");
	return false;});
	});
</script>

<!-- pop up window -->
<!! here the query staff -->
<form name="getbyuser" method="post" action="ajax/getallimages.cfm">
    <select onchange="document.getbyuser.submit()" id="getbyusers" name="getbyusers">
       <option selected="selected" value="">all</option>
       <option value="1">test1</option>
       <option value="2">test2</option>
    </select>
 </form>
    
    
<form name="getbycat" method="post" action="ajax/getallimages.cfm">    
    <select onchange="document.getbycat.submit()" style="width: 200px;" id="getbycategory" name="getbycategory">
       <option selected="selected" value="">all</option>
       <option value="5">cat 1</option>
       <option value="10">cat 2</option>
    </select>
</form>


<form name="getbycon" method="post" action="ajax/getallimages.cfm">
    <input type="text" name="getbycontent" value="">
    <input type="submit" value="Search" name="Search">
    </form>
<!-- here the output -->
<table  class="maintable" width="100%" cellspacing="1">
 <tr>
    <td class="tableheader">&nbsp;</td>
    <td class="tableheader">ID.</td>
    <td class="tableheader">Thumb</td>
  </tr>

 <tr>
     <td class="row"><input name="Art_ID" id="checkybox_1" type="checkbox" value="4" /></td>
     <td class="row">4</td>
     <td class="row"><div><img src="../../artimages/thumbs/test1.jpg" width="40" height="30"/></div></td>
</tr>
 <tr>
     <td class="row"><input name="Art_ID" id="checkybox_2" type="checkbox" value="14" /></td>
     <td class="row">14</td>
     <td class="row"><div><img src="../../artimages/thumbs/test2.jpg" width="40" height="30"/></div></td>
</tr>
 

<tr><td colspan="3">
<div style="padding-top:10px"><a href="#"  id="submitbutton" class="ui-state-default ui-corner-all">add images</a></div></tr>

</table>
<script language="javascript">
$(document).ready(function(){
	$("#submitbutton").click(function(){
		$textarea = $("#images");
		$("table.maintable td").each(function(){
			if($("input:checked", this).attr("id") != undefined)
				$textarea.val($textarea.val() + $("input:checked", this).attr("id")+ ",");
		});
	});
});
</script>

Answer : Jquery ui modal and using form in the pop up window.

Just when I test and prepare my below comment, shortiiik has posted a similar solution....anyway I am posting here if it helps in some way.....

Yes. UrlReferer is correct first time when page loads, then any action in the page inside web part changes UrlReferer to itself...

I think you need to save the original referer value when page inside the web part loads first time in Session variable and use it later...


      protected void Page_Load(object sender, EventArgs e)
        {
         if (Session["OriginalUrlReferer"] == null) // or use IsPostBack
                Session["OriginalUrlReferer"] = System.Web.HttpContext.Current.Request.UrlReferrer;
        }


      // to use it later...
      protected void Button2_Click(object sender, EventArgs e)
        {
            Uri originalReferer = (Uri)Session["OriginalUrlReferer"];
        }

Random Solutions  
 
programming4us programming4us