Forum

HomeHomeCoreCoreGeneralGeneralModal PopupModal Popup
Previous
 
Next
New Post
11/5/2015 1:35 AM
 

Hello,

I'd like to show the results of an ajax call in a modal popup so that the original page stays in place underneath, does anyone have an example they could share that would help me learn how to do this please?  I'm using DNN 6.2.9

Many thanks

Barry

New Post
11/5/2015 2:44 AM
 
Hi Barry,
I use popups all the time to get a user response, edit data, change passwords, display options, etc. I use Fancybox to do this but I'm sure you can amend my code to use some other popup plugin
Here is a javascript code snippet that uses ows.Fetch to populate a DIV and then opens a fancybox window with that content. Once the popup is closed the script clears the content from the div
Of course it assumes you have the fancybox javascript and css loaded. You can get those from http://fancyapps.com/fancybox/
If you need a full configuration example let me know. Over the weekend I will upload a configuration that I have that prompts the use to change their password in a Fancybox popup
Regards
Tony


<script>
function OpenPopup[MODULEID,SYSTEM]() {
ows.Fetch([MODULEID,SYSTEM],-1,'A=GETCONTENT','div[MODULEID,SYSTEM]');
$.fancybox.open({
href : '#div[MODULEID,SYSTEM]',
autoSize: false,
height: 500,
width: 500,
afterClose: function() {$('#div[MODULEID,SYSTEM]').html('')},
helpers: {
overlay : {
speedIn : 500,
opacity : 0.70
}
}});
}
</script>
<div id="div[MODULEID,SYSTEM]" style="display:none;"></div>


New Post
11/5/2015 7:26 AM
 

Tony, you're a star!

It took a bit of playing with (frankly, javas crypt frightens me!) but I'm pretty much there. Thank you very much indeed.

Currently I have the function looking like this :

function OpenPopup[MODULEID,SYSTEM](pID) {
ows.Fetch([MODULEID,SYSTEM],-1, pID,'div[MODULEID,SYSTEM]');
$.fancybox.open({
href : '#div[MODULEID,SYSTEM]',
autoSize: false,
height: '75%',
width: '75%',
afterClose: function() {$('#div[MODULEID,SYSTEM]').html('')},
helpers: {
overlay : {
speedIn : 500,
opacity : 0.70
}
}});
}

I have a fixed action string on each row in my report eg 'Action=getCustomersModal&Type=s&ID=[ISBN]' and pass this to the function like this:

<a onclick=\"javas cript:OpenPopup\[ModuleId,system\]('Action=getCustomersModal&Type=s&ID=\[ISBN\]'); return false;\"> (it's in an IIF statement).  

I would like to pass just the ISBN column value and have the rest of the action string in the function, but have failed to achieve this, is it possible within OWS?


New Post
11/5/2015 8:25 AM
 
function OpenPopup[MODULEID,SYSTEM](pISBN) {
ows.Fetch([MODULEID,SYSTEM],-1, 'Action=getCustomersModal&Type=s&ID=' + pISBN,'div[MODULEID,SYSTEM]');
$.fancybox.open({
href : '#div[MODULEID,SYSTEM]',
autoSize: false,
height: '75%',
width: '75%',
afterClose: function() {$('#div[MODULEID,SYSTEM]').html('')},
helpers: {
overlay : {
speedIn : 500,
opacity : 0.70
}
}});
}

<a onclick=\"javascript:OpenPopup\[ModuleId,system\]('\[ISBN\]'); return false;\">


Notice I concatenate the ISBN parameter with the rest of the string in the function

Tony


New Post
11/5/2015 11:26 AM
 

Thanks Tony,  I'll be back in the office tomorrow to try this combination.

I thought that the action parameter had to be surrounded with single quotes so had tried something like
" 'Action=getCustomersModal&Type=s&ID="+pISBN+"' " but that only sent a NULL value, looking forward to trying your suggestion out!

Previous
 
Next
HomeHomeCoreCoreGeneralGeneralModal PopupModal Popup


 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • info@openwebstudio.com

Bookmark & Share Bookmark and Share