Thread jQuery, modal-dialog & form submit (20 answers)
Opened by pktm at 2010-02-19 17:22

pktm
 2010-02-19 19:26
#133337 #133337
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
Ja, ok. Und wie werte ich die Antwort von dem Dialog aus, den ich verlinkt habe?
Hier mal mein Ansatz:
Code: (dl )
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>modal dialog test</title>

<link type="text/css" href="jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.7.2.custom.min.js"></script>

<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
});

function my_dialog() {
var dialog_response = true;

$("#dialog").dialog({
bgiframe: true,
resizable: false,
height:140,
modal: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
'Delete all items in recycle bin': function() {
$(this).dialog('close');
dialog_response = true;
},
Cancel: function() {
$(this).dialog('close');
dialog_response = false;
}
}
});

return dialog_response;
} // my_dialog
</script>
</head>
<body>

<div id="dialog" title="Empty the recycle bin?" style="display: none;">
<p>
<span class="ui-icon ui-icon-alert"
style="float:left; margin:0 7px 20px 0;"></span>
These items will be permanently deleted and cannot be
recovered. Are you sure?
</p>
</div>

<form action="test.html" class="del_form" onsubmit="my_dialog()">
<input type="submit" value="del 1" />
</form>

<form action="test.html" class="del_form" onsubmit="my_dialog()">
<input type="submit" value="del 2" />
</form>

</body>
</html>


Im Moment wird der Dialog kurz angezeigt und dann test.html aufgerufen (gemäß dem action-Attribut). Ich will aber, dass man erst den Dialog betätigen muss, bevor da was abgeschickt wird.

Grüße, pktm
http://www.intergastro-service.de (mein erstes CMS :) )

View full thread jQuery, modal-dialog & form submit