PDA

View Full Version : BasicDialog disapears



greeklinux
29 Jan 2007, 3:57 PM
Hello,

i have a problem. i set up a basic dialog. it opens if the button is clicked,
but then it suddenly disappears. I dont know why. i searched the forum
but i found nothing. is it a known problem?

JohnT
29 Jan 2007, 4:25 PM
Welcome to the forums.

Could you post a link, or some code? I think you will have a much better chance of resolving your problem if you do.

Regards,

John T.

greeklinux
30 Jan 2007, 1:38 PM
Hello,

thank you JohnT.

This is my Javascript code:


...
/* yui-extends msg dialog */

var directMsgCompose = function() {
var dialog, dMsgButton;

return {
init : function() {
dMsgButton = getEl("directmsg");
dMsgButton.on("click", this.showDialog, this, true);
},
showDialog : function() {
if (!dialog) {
dialog = new YAHOO.ext.BasicDialog("directmsgdialog", {
modal:true,
width:500,
height:300,
minWidth:300,
minHeight:250,
proxyDrag: true
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton("Close", dialog.hide, dialog);
dialog.addButton("Submit", dialog.hide, dialog).disable();
}
dialog.show(dMsgButton.dom);
},
};
}();

YAHOO.ext.EventManager.onDocumentReady(directMsgCompose.init, directMsgCompose, true);
...


This is the HTML code:


<div id="directmsgdialog">
<div class="ydlg-hd"><? echo $Language['tmpdata']['composemessage']; ?></div>
<div class="ydlg-bd">

<table align="center">
...
</table>

</div>
</div>
...
<input id="directmsg" type="button" value="msg" />
...



can you see any error?

thx

JohnT
30 Jan 2007, 1:43 PM
Extra comma maybe? Near:




dialog.show(dMsgButton.dom);
},



???

greeklinux
30 Jan 2007, 2:30 PM
Hello,

no, i removed the comma, but it is the same. The Dialog display and after 2 secs
it closes automaticaly. Is it important, where the definition of directmsgdialog
takes place?

Thx

tryanDLS
30 Jan 2007, 2:35 PM
Trying making your button a simple div rather than an input tag - maybe something is triggering a form submit?

JohnT
30 Jan 2007, 2:41 PM
remove that extra comma

add :




<div id="directmsg"> Click me</div>



and as Tim suggested, it will work.

Regards,

John T.

daviferreira
30 Jan 2007, 3:24 PM
I think all you need to use the dialog style inline... At least I got that once when I started to play around with yui-ext. The dialog disappeared after dragging or something :)



<div id="directmsgdialog" style="visibility:hidden;position:absolute;top:0px;">

greeklinux
31 Jan 2007, 10:09 AM
Hello,

thanks for the hints. It function with a div instead of an input element.

i have different "users" and i want that a new dialog opens that includes the
username. I am new to yui/yui-ext. but i have first only to alter my "username"-tag
with JS in DOM and then open the dialog, right?

Thank you