Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7797 closed enhancement (duplicate)

use iframe for navegate

Reported by: ppkrauss Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.dialog Version: 1.8.16
Keywords: Cc:
Blocked by: Blocking:

Description

It is so ease for user (a programmer that is using jQuery-UI) point a URL to navigate, like a "help hypertext", into the modal dialog.

Change History (4)

comment:1 Changed 8 years ago by ppkrauss

Another problem have a not simple (!!!) work-around,

Suppose that the (modal) dialog is a form that need to validate data and return to yourself.

<?php
/**
 * form_ws.php
 * REMOTE FORM DEMO: submit and return here with php-processed fields.
 * (need only HTML fragments)
 */
 $s = @$_POST['s'];
 $s = $s? "OLD($s)": ''; // do something with it
?>
<h2>On dialog opened form</h2>
<form action="form_ws.php" onsubmit="return postFormAtResult(this,'#_callModal_',event);">
	<input type="text" size="40" name="s" placeholder="Enter something..." value="<?=$s?>" />
	<input type="submit" value="GO" />
</form>

Then suppose the man page, the caller, it need some extra-javascript general functions (postFormAtResult and callModal) to perform the "remote recurrence".

<!DOCTYPE html>
<html>

<head>

<title>form_getFormModal</title>
<link type="text/css" href="css/ui-lightness/jquery-ui.custom.css" rel="stylesheet" />	
<script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
/**
 * postFormAtResult 1.0
 *  Use at tag form submit="postFormAtResult(this,'#name',event)"
 *  to show response-form data at a result-div.
 */
function postFormAtResult(form,result,event) {
	var f = $(form);
	event.preventDefault(); 
	$.post(	f.attr('action'), 	// url
		f.serialize(),		// send all input
		function( data ) {	// resopnse with all result
		  $( result ).empty().append( data );
		}
	);
	return false;
}

/**
 * callModal 1.0
 *   Use into a onClick event to show a jQueryUI-modal-dialog.
 */
function callModal(event,url,title) {
	return callModal_main(event,url,title,'70%',400);
}
var callModal_main_obj;  // global for close, see INIT.
function callModal_close() {
	callModal_main_obj.remove();
}
function callModal_main(event,url,dgtitle,dgwidth,dgheight) {
	event.preventDefault();
	if (dgtitle==undefined) {dgtitle='';}
	callModal_main_obj.load(
		url, {}, //old {_idresult_: idresult},  removido porque polui o $_POST e o usuário!
		function (responseText, textStatus, XMLHttpRequest) {
		    callModal_main_obj.dialog({
			width: dgwidth,
			height: dgheight,
			modal: true,
			title: dgtitle,
			close: function(event, ui) {
			    callModal_main_obj.remove();
			}
		    }); //dialogg
		} // function
	); // load
	return false;
}
$(document).ready(function() {  // INIT callModal
	callModal_main_obj = $('<div id="_callModal_" style="display:none">').appendTo('body');
});
</script>
</head>

<body>
<a href="#" onclick="callModal(event,'form_ws.php?modo=form', 'TITLE')">ACTIVATE MODAL FORM</a>
</body>
</html>

comment:2 Changed 8 years ago by Scott González

Resolution: duplicate
Status: newclosed

comment:3 Changed 8 years ago by Scott González

Duplicate of #5300.

comment:4 in reply to:  3 Changed 8 years ago by ppkrauss

Replying to scott.gonzalez:

Duplicate of #5300.

This tiecket NOT is a #5300 duplication (!): THERE ARE A PROBLEM OF NAVIGATION,

$( el ).load( url ).dialog();

IS NOT A SOLUTION FOR BASIC HTML HYPERTEXT: user can not navigate.

... And solutions like "parse all page",

http://blog.nemikor.com/2009/04/18/loading-a-page-into-a-dialog/

are not an acceptable solution (it is a hack!).

THIS TICKET IS ABOUT PROBLEM of NAVIGATION, and the added comment show how this also impact on FORMS (send/response in the same dialog).

Note: See TracTickets for help on using tickets.