Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesConfirmation Popup QuestionConfirmation Popup Question
Previous
 
Next
New Post
4/8/2011 3:55 PM
 
Hi All

I need to add a confirmation pop on a button click. I know I can do it by calling ClientAPI.AddButtonConfirm(BUTTON, "Text"). That works just fine. The problem I've got is I need that message to be multiline. I've tried changing the "Text" in my example to use a <br /> but that just prints out <br /> in the popup. I've also tried using the newline and carriage return values for Javascript but when I use those I end up with javascript errors on the page, the confirmation doesn't show up, and when I look at the source it has the newline showing up right where I used the javascript code.

So..... does anyone know of a way to add a new line to AddButtonConfirm?
 
New Post
4/8/2011 4:54 PM
 
The Javascript return and new line escapes \r\n or even \n alone have worked for me. If they are causing a new line to appear in the page source instead make sure that you are not missing a single or double quote if you are building the confirmation string in code.

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
4/8/2011 5:21 PM
 
This was the last version I tried....

sReturn = "Confirm Transaction:\nTest";

I've also tried:

sReturn = "Confirm Transaction: " + "\n" + "Test"; and sReturn = "Confirm Transaction: '\n' Test";
 
New Post
4/9/2011 10:44 AM
 
Mike,

Knowing that using the \r\n return and line-feed escapes had once worked (a long time ago) for me, I had to do a quick test in a module I'm working on which also uses the ClientAPI.AddButtonConfirm method. It failed in the same manner you indicated. I then took a look at the ClientAPI code (http://dnnclientapi.codeplex.com) and found that a modification had been made (not recently) such that the ClientAPI.GetSafeJSString now escapes the backslash character as well as single and double quote characters thus preventing \r or \n from being recognized as return and line-feed characters. Unfortunately I don't see any way of passing a string containing any character escape to the AddButtonConfirm method. The simplest solution would be to add the Javascript confirm call to the button control's onClick attribute:

btnDelete.Attributes.Add("onClick", " return confirm('" & confirmText & "');")

or

btnDelete.OnClientClick=" return confirm('" & confirmText & "');"

In looking for the ClientAPI source in the DotNetNuke source (before remembering that it is now available only on CodePlex), I came across a new method in the DotNetNuke.Web.UI namespace that would seem useful for this and makes use of the new DNNWindowManager available in DNN 5.x:

Public Shared Function GetOnClientClickConfirm(ByRef ctrl As Control, ByVal message As String) As String

I would presume (but have not tried it) that it would be called as follows:

btnDelete.OnClientClick=DotNetNuke.Web.UI.GetOnClientClickConfirm(btnDelete, confirmText)

The GetOnClientClickConfirm method escapes only the single and double quotes not any '\' character in the message.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
4/10/2011 4:36 PM
 
Thanks for digging Bill. I'll check it out tomorrow when I'm at work. They don't pay me enough to continue programming on my weekend. :)
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesConfirmation Popup QuestionConfirmation Popup Question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out