-
1. Re: cfmessagebox error whatever parameters
BKBK May 14, 2014 3:14 AM (in response to plarts)You have omitted some information, so it is difficult to say. In any case, you should have included the line ColdFusion.MessageBox.show('PopMessage'); within a function. Start with something like
<html>
<head>
<script type="text/javascript">
//CallbackHandler
var GrabUserInput = function(btn,message){
alert(message);
}
//Button onClick handler
function showMB(mbox) {
ColdFusion.MessageBox.show('PopMessage');
}
</script>
</head>
<body>
<cfform>
<cfinput name="Alert" type="button" value="Alert" onclick="showMB('PopMessage')">
</cfform>
<cfmessagebox name="PopMessage"
callbackhandler="GrabUserInput"
labelok="Check info"
title="Warning!"
icon="warning"
type="alert"
message="This is a message box"/>
</body>
</html>
-
2. Re: cfmessagebox error whatever parameters
plarts May 14, 2014 4:24 AM (in response to BKBK)OK thanks, I see.
Need to handle the "GrabUserInput"
or something similar. or ommit it.
Not easy to use.
Basic javascript (alert, confirm, prompt) are less nice looking,
but easier and faster to use.
I tried this :
<cfmessagebox name="PopMessage"
labelok="Check info"
title="Warning!"
icon="warning"
type="alert"
message="This is a message box"/>
<script type="text/javascript">
function al() {
ColdFusion.MessageBox.show('PopMessage');
}
al();
</script><input type="button" value="ok" onClick="al()">
The button onClick works.
But the called function al() in the JS code does not work
So, it seems it only works on "clicks" not in JS code.
could you confirm ?
Thanks, Pierre.
-
3. Re: cfmessagebox error whatever parameters
BKBK May 14, 2014 5:56 AM (in response to plarts)Just as well you ask. It made me see a mistake in the code I gave you. The function should instead read
function showMB(mbox) {
ColdFusion.MessageBox.show(mbox);
}
Accordingly, the latest code you mention should be
<script type="text/javascript">
function al(arg) {
ColdFusion.MessageBox.show(arg);
}
// al();
</script>
<input type="button" value="ok" onClick="al('PopMessage')">
or, alternatively,
<script type="text/javascript">
function al() {
ColdFusion.MessageBox.show('PopMessage');
}
// al();
</script>
<input type="button" value="ok" onClick="al()">
-
4. Re: cfmessagebox error whatever parameters
plarts May 14, 2014 7:45 AM (in response to BKBK)Thanks for answering,
What I mean, is that this MessageBox cannot be called Inside a Javascript code.
it must be in onClick button function ?
When I said :
<script type="text/javascript">
function al() {
ColdFusion.MessageBox.show('PopMessage');
}
al();
</script>
the al() should show the box, but it did not.
the al() in an input button onClick, it does show the box.
So this cannot be used in a javascript code ?
Pierre.
-
5. Re: cfmessagebox error whatever parameters
BKBK May 14, 2014 7:54 AM (in response to plarts)My reaction was:
// al();

