Radprompt - Get clicked button

2 posts, 1 answers
  1. Laz
    Laz avatar
    31 posts
    Member since:
    Apr 2009

    Posted 16 Oct 2009 Link to this post

    Hi to all,

    it is possible to get the clicked button of a radprompt?

    I try to check if the OK Button is clicked and the Textbox left blank to call another Alert with an error message.

    My problem is that when i clicked the CANCEL Button i get the NULL Value and when i left blank the textbox and click the OK Button then i also geht the NULL Value.

        <script type="text/javascript">  
     
            function openPrompt(TitleText, Text, IText, IIndex) {  
                document.getElementById("<%= hdnIIndex.ClientID %>").value = IIndex;  
                radprompt(Text + '<br style="clear:both" /><strong>' + IText + '</strong>', promptCallBackFn, 330, 100, null, TitleText, null);  
            }  
     
            function promptCallBackFn(arg) {  
     
                document.getElementById("<%= hdnText.ClientID %>").value = arg;  
                if (arg != null && arg != '') {  
                    document.getElementById("Refresh").click();  
                }  
                else {  
                    radalert('You have clicked OK, but the text is blank', 330, 100, 'Error Msg'); return false;  
                }  
            }  
     
        </script> 
  2. Answer
    Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 19 Oct 2009 Link to this post

    Hi Laz,

    Please make sure that you are using a recent version of the control. RadWindow's radprompt dialog will return empty string if the textfield is left blank and the user hits the OK button.
    function openPrompt()
    {
     
        radprompt("Please provide value", callbackFn);
    }
     
    function callbackFn(arg)
    {
        if(arg == "")
        {
            radalert("please provide valid value");
        }
    }


    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top