Hybrid View

  1. #1
    psaraf
    Guest

    Default Alternate way for Confirmation Box

    Alternate way for Confirmation Box


    Hi,
    I have a situation, when some one click on link(anchor) it should ask for confirmation. if i do normal way of JS it works fine because my method calls JS confirm() function, return true or false, if I use Ext Confirmation box, it won't stop the execution and goes ahead.
    What is solution if i want to use Ext Confirmation box?

    I know that MessageBox is asynchronous and it did not stop the execution. i just need an alternate and easy way to do it.

    My Code
    HTML
    Code:
    <a href="begin.do" onclick="return deleteAlert()>Delete</a>
    Ext Code
    Code:
        returnVar = false;
        deleteAlert = function(){
             Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete  it >",validateConfirm);        
             return returnVar;
        }
        function validateConfirm(bn)
        {       
            if(bn == "yes")
            {      
                returnVar =  true;
            }
            else
            {   
              returnVar = false;
            }
        }

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,803
    Vote Rating
    606
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    That's not how it works.

    You'll need to do something like:

    Code:
    //get all anchors on the page
    Ext.select('a').on('click', function(e)
    {
       e.stopEvent(); //stop the event
       Ext.MessageBox.confirm('foo', 'bar', function(btn)
       {
          if (btn == 'yes')
             document.location.href = e.getTarget().href;
       }
       );
    }
    );
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi