erikTsomik
asked on
Jquery popUp
I need to create a modal screen when user click on the link it will
launch the modal screen with the set of drop downs. Upon clicking the save
button I need to close the modal and pas the value back to the parent screen
Any help
launch the modal screen with the set of drop downs. Upon clicking the save
button I need to close the modal and pas the value back to the parent screen
Any help
window.showModalDialog or jQuery UI will do just that
ASKER
I am using jquery UI but the close button does not work
ASKER
I did exaxctly what the example is doing still no luck.
$(document).ready( function() {
$("#linkClick").click( function(event){
$( "#dialog:ui-dialog" ).dialog( "destroy" );
event.preventDefault();
$("#content").load('index. html');
$('#content').dialog({
resizable: true,
modal: true,
closeOnEscape:false,
draggable:true,
scrollbars:false,
width: 660,
height: 400,
position: 'middle',
buttons: {
"OK": function() {
alert('Hello');
$('#content').dialog("clos e");
//$('#').dialog("close");
$('#content').dialog('dest roy')
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
//alert('Hello');
return false;
});
});
$(document).ready( function() {
$("#linkClick").click( function(event){
$( "#dialog:ui-dialog" ).dialog( "destroy" );
event.preventDefault();
$("#content").load('index.
$('#content').dialog({
resizable: true,
modal: true,
closeOnEscape:false,
draggable:true,
scrollbars:false,
width: 660,
height: 400,
position: 'middle',
buttons: {
"OK": function() {
alert('Hello');
$('#content').dialog("clos
//$('#').dialog("close");
$('#content').dialog('dest
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
//alert('Hello');
return false;
});
});
Did you include jquery libraries?
ASKER
yes. All libraries are there it lanches the box I can even see the alert box after I clicked on the OK , but ca not close it
ASKER
is that because I am using event.preventDefault(); but otherwise it will reload the parent form
I would need to see a page
ASKER
it is on the local machine
ASKER
<script type="text/javascript">
$(document).ready( function() {
$('#content').dialog({
autoOpen: false
});
$("#linkClick").click( function(event){
$( "#dialog:ui-dialog" ).dialog( "destroy" );
event.preventDefault();
$("#content").load('index2 .html');
$('#content').dialog({
resizable: true,
modal: true,
closeOnEscape:false,
draggable:true,
scrollbars:false,
width: 660,
height: 400,
position: 'middle',
buttons: {
"OK": function() {
alert('Hello');
$(this).dialog("close");
//$('#').dialog("close");
$('#content').dialog('dest roy')
},
"Cancel": function() {
$(this).dialog("close");
} ,
//close: function(ev, ui) { $(this).close(); },
}
});
//alert('Hello');
return false;
});
});
</script>
<form action="index.html method="post" enctype="application/x-www -form-urle ncoded">
<a href="" id="linkClick" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>Ope n Dialog</a>
<div id="content" style="display: none;"></div>
</form>
$(document).ready( function() {
$('#content').dialog({
autoOpen: false
});
$("#linkClick").click( function(event){
$( "#dialog:ui-dialog" ).dialog( "destroy" );
event.preventDefault();
$("#content").load('index2
$('#content').dialog({
resizable: true,
modal: true,
closeOnEscape:false,
draggable:true,
scrollbars:false,
width: 660,
height: 400,
position: 'middle',
buttons: {
"OK": function() {
alert('Hello');
$(this).dialog("close");
//$('#').dialog("close");
$('#content').dialog('dest
},
"Cancel": function() {
$(this).dialog("close");
} ,
//close: function(ev, ui) { $(this).close(); },
}
});
//alert('Hello');
return false;
});
});
</script>
<form action="index.html method="post" enctype="application/x-www
<a href="" id="linkClick" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>Ope
<div id="content" style="display: none;"></div>
</form>
I do not see anything special.
I'll try to do a fiddle tomorrow
I'll try to do a fiddle tomorrow
ASKER
OK
I cannot test it in fiddle because I do not have your html file you load
http://jsfiddle.net/mplungjan/wkXEu/
http://jsfiddle.net/mplungjan/wkXEu/
ASKER
Those html only consists of 3 drop downs
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok. Got it How can i pass the selected value to the parent screen
There is no parent screen. The popup is IN the parent screen - so where I call alert, just call a function in the page you are in
continueTheProcess(vals);
continueTheProcess(vals);
ASKER
how can i pass the ID of the fileds for text and ID back. For example I have 2 links linkClick once I click on each one of them and Click OK on the dialog box I need to return the value and the text. It works Fine If I have only 1 link then i know exactly where to put it. What If I have more than 1 link then i need to dynamically specify the id of 2 elements where I want to store them
Just set two vars AND call a function or pass { field1:"value",field2:"val ue2"}
ASKER
can you give me an example how to do that , I never use this approach. Can it be just a name of div tat I want to write result into ?
ASKER
is there any update on this issue
"Show all items": function() {
var result ="";
$(this).find("select").eac h(function () {
result+=$(this).attr("name ") + ': '+ $(this).val()+"<br/>";
});
$("#resultDiv").html(resul t);
$( this ).dialog( "close" );
},
var result ="";
$(this).find("select").eac
result+=$(this).attr("name
});
$("#resultDiv").html(resul
$( this ).dialog( "close" );
},
ASKER
thank you