2016-08-17 6 views
3

Я использую sweetalert2 для проверки адреса электронной почты, но я бы хотел, чтобы он отображал текстовый ввод имени, которое нужно ввести. Я понимаю, что это цепочка модалов, но я не могу для жизни меня понять, как из приведенного на странице примера?Chaining sweetalert2 modals

var cloud_email = $('.cloud_email').text(); 
var user_name = $('.user_name').text();; 
swal.setDefaults({ 
    confirmButtonText: 'Next →', 
    showCancelButton: true, 
    animation: false 
}); 

var steps = [ 
    { 
    //ask for and validate email here 
    type: 'question', 
    title: 'Please enter email address', 
    input: 'email', 
    inputValue: cloud_email 
    }, 
    { 
    //ask for and validate text input here 
    type: 'question', 
    title: 'Please enter user name', 
    input: 'text', 
    inputValue: user_name 
    } 
]; 

swal.queue(steps).then(function(email, name) { 
    swal({ 
    type: 'success', 
    html: 'Email successfully sent to: ' + name + ': '+ email 
    }); 
}).finally(function() { 
    swal.resetDefaults(); 
    //ajax to process values passed 
}) 

Моя попытка возвращает эту ошибку:

swal.queue(...).then(...).finally is not a function 

ответ