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

How to convert Javascript code to call the RadWindow

7 Answers 113 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 25 Nov 2008, 11:18 PM
Hi..
How do I modify the following javascript code to call the RadWindow vs. the Confirm() method.


sSave = window.confirm(

"You have some changes that have not been saved. Click OK to SAVE now or CANCEL to continue without saving.");

 

 

7 Answers, 1 is accepted

Sort by
0
Jon
Top achievements
Rank 1
answered on 25 Nov 2008, 11:56 PM
Hi.. I changed it to

sSave = radconfirm(

"You have some TRU changes that have not been saved. Click OK to SAVE now or CANCEL to continue without saving.");

 


BUT I get 2 windows... A IE confirmation and then a RADWINDOW

????
Any ideas?

0
Shinu
Top achievements
Rank 2
answered on 26 Nov 2008, 04:58 AM
Hi Jon The Nerd,

Unlike the normal window.confirm, RadConfirm takes atleast two arguments- string message and the name of the function that deals with the results. In your example change the Confirm Dialog as shown below.

radconfirm("You have some TRU changes that have not been saved. Click OK to SAVE now or CANCEL to continue without saving."confirmCallBackFn);  

Add the JavaScript function named "confirmCallBackFn" for checking the result:
<script type="text/javascript"
function confirmCallBackFn(arg) 
    if (arg==true
        //Clicked OK 
    else 
        //Cliked Cancel   
</script> 

Please refer the online documentation for more details:
Working with the Confirm Dialog

Thanks,
Shinu.






0
Jon
Top achievements
Rank 1
answered on 26 Nov 2008, 12:50 PM
Thanks.. How do I make it modal?
0
Vyrban
Top achievements
Rank 1
answered on 26 Nov 2008, 01:10 PM
Hi Jon,

If i'm not wrong Radconfirm, RadAlert and RadPrompt ARE modal. In the sense that they disable elements on the page until they are closed. Think this is modal window. :)
0
Jon
Top achievements
Rank 1
answered on 26 Nov 2008, 01:10 PM
Hi.. This is what I have.. I set the radwindow to modal but it doesn't work.. thanks!

 

<script type="text/javascript" language='JavaScript'>

 

window.onbeforeunload = checkSave;

 

 

var isDirty;

 

isDirty = 0;

 

function setDirty() {

 

isDirty = 1;

}

 

function checkSave() {

 

 

var sSave;

 

 

if (isDirty == 1) {

 

sSave = radconfirm(

"You have some TRU changes that have not been saved. Click OK to SAVE now or CANCEL to continue without saving.", confirmCallBackFn, 300, 100, null, 'TRU');

 

 

}

}

 

</script>

 

 

 

<script type="text/javascript">

 

function

 

confirmCallBackFn(arg)

 

{

 

if (arg == true) {

 

 

//Clicked OK

 

}

 

else {

 

 

//Cliked Cancel

 

}

}

</

 

script>

 

0
Jon
Top achievements
Rank 1
answered on 26 Nov 2008, 01:13 PM
The code allows  does not make the radwindow modal even though I set it to modal.
and I can navigate away from the page.
thanks
0
Tervel
Telerik team
answered on 26 Nov 2008, 03:14 PM
Hi Jon,

All RadWindows (including confirm, prompt and alert popups) are DHTML objects - that is, they consist of HTML and JavaScript. With HTML it is not possible to achieve absolute modality - like it can be done with a browser alert for example. That is, the modality of the RadWindow goes only as far as the content page of the browser, but it cannot disable user actions such as typing a new URL in the browser address bar or using the Back/Forward/Reload browser buttons.

Greetings,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Jon
Top achievements
Rank 1
Answers by
Jon
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Vyrban
Top achievements
Rank 1
Tervel
Telerik team
Share this question
or