This is a migrated thread and some comments may be shown as answers.

Radconfirm return values

3 Answers 307 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 04 Jul 2014, 06:12 PM
Hello Forum

Is there at way to retrieve clickresult from Radconfirm from within a javascriptfunction.

This might be a trivial question, im not sure, I have been starring me blind on solving this. :)

Here goes my last shot that didnt work, any hints are welcome:

 function MainFn() {

             var answer= confirmFn("OK CANCEL ?");              
              alert(answer);
              if (answer==false)
                  return false;  //Break here    
               
               //else  do something more....

               // return an end result
              return false;
                     
          } 


 function confirmFn(text) {
              var callBackFn = function (arg) {
                  if (arg) {                      
                      return true;
                  }
                  else {
                      return false;
                  }

              }
              radconfirm(text, callBackFn);
          } 



         

3 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 04 Jul 2014, 06:17 PM
To clarify; this is what i am looking for, only with use of radconfirm :

function MainFn() {

           
                  if (confirm("OK CANCEL?") == false)
                  { return true; }   
                                      
               //else  do something more....

               // return an end result
              return false;
                     
          } 
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Jul 2014, 04:33 AM
Hi Mark,

Please try to use the RadConfirm to achieve your scenario. Here is the sample code snippet which works fine at my end.

JavaScript:
function pageLoad() {
    radconfirm("OK CANCEL?", callBackFunction, 500, 500, null, "Confirm");
}
function callBackFunction(args) {
    if (args == true) {
        //your code
    }
}

Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.
0
Mark
Top achievements
Rank 1
answered on 07 Jul 2014, 08:37 AM
Thanks for your input Shinu

Im sorry I forgot to mention that the radconfirm is supposed to break a buttons postback by returning "false" ;

 <asp:Button ID="Button1" OnClientClick="MainFn"  OnClick="Button1_Click" runat="server" Text="Button" />

I have  found this to work:

 function MainFn(sender, args) {
            
                   var callBackFunction = Function.createDelegate(sender, function (shouldSubmit) {
                       if (shouldSubmit) {
                           alert("Do something more..then postback");
                           this.click();
                       } 
                    else {
                           alert("cancel selected. do nothing..");
                       }
                   });
                   var text = "Are you sure you want to submit the page?";
                   radconfirm(text, callBackFunction, 300, 160, null, "RadConfirm");
                   args.set_cancel(true);  // postback(radbutton) stopped
               }
             









Tags
Window
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or