I need a simple pop up window for displaying a detail policies when users click on a link. So within texts there will be a link such as see detail here and when user click see detail here a pop up windows show up. I know how to do it in javascript but this type of pop up nowadays looks so ancient and can be blocked by pop up blocker. Can I use cfmessagebox? I have googled and got many examples but none is calling the cfmessagebox from a link. Can anyone help?
Asked
Active
Viewed 4,026 times
-1
-
You are over-thinking it ;-) Most examples just call a javascript function. [Calling a function from a hyperlink](http://stackoverflow.com/questions/1265887/call-javascript-function-on-hyperlink-click) is not that different than invoking it on a button click. First result: http://stackoverflow.com/questions/1265887/call-javascript-function-on-hyperlink-click . Having said that, in the long run you are better off using something else instead, like jQuery. The CF ajax features use outdated libraries and are brittle and difficult to customize. – Leigh Jan 07 '15 at 17:18
1 Answers
0
according to the documentation
<script type="text/javascript">
function showMB(mbox) {
ColdFusion.MessageBox.show(mbox);
}
</script>
<cfform>
<p>Click a button display the corresponding message box.</p>
<cfinput name="Prompt" type="button" value="Prompt"
onclick="showMB('mymessagebox01')">
</cfform>
<!--- Code to define the message boxes. --->
<cfmessagebox name="mymessagebox01" type="prompt"
message="Write a short description about yourself"
labelOK="This is OK" labelCANCEL="Cancel this"
callbackhandler="showResult1" multiline="true"/>
form/button code can be rewritten into:
<a href="javascript:showMB('mymessagebox01')">show</a>
or
<a href="#" onclick="showMB('mymessagebox01')">show</a>

Iłya Bursov
- 23,342
- 4
- 33
- 57