Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

swal.fire on click back and forth forward

const steps = ['1', '2', '3']
const swalQueueStep = Swal.mixin({
    confirmButtonText: 'Forward',
    cancelButtonText: 'Back',
    progressSteps: steps,
    input: 'text',
    inputAttributes: {
        required: true
    },
    reverseButtons: true,
    validationMessage: 'This field is required'
})
async function backAndForth() {
    const values = []
    let currentStep
    for (currentStep = 0; currentStep < steps.length;) {
        if (steps[currentStep] == 1) {
            var result = await swalQueueStep.fire({
                title: 'Question .' + steps[currentStep],
                inputValue: values[currentStep],
                showCancelButton: currentStep > 0,
                currentProgressStep: currentStep
            })
        } else if (steps[currentStep] == 2) {
            var result = await swalQueueStep.fire({
                title: 'Question ..' + steps[currentStep],
                inputValue: values[currentStep],
                showCancelButton: currentStep > 0,
                currentProgressStep: currentStep
            })
        } else if (steps[currentStep] == 3) {
            var result = await swalQueueStep.fire({
                title: 'Question ...' + steps[currentStep],
                inputValue: values[currentStep],
                showCancelButton: currentStep > 0,
                currentProgressStep: currentStep
            })
        } else {
            break
        }
        if (result.value) {
            values[currentStep] = result.value
            currentStep++
        } else if (result.dismiss === 'cancel') {
            currentStep--
        } else {
            break
        }

        if (currentStep === steps.length) {
            Swal.fire(JSON.stringify(values))
        }
    }
}
backAndForth();
Comment

PREVIOUS NEXT
Code Example
Javascript :: moment get end of next moenth 
Javascript :: how to add class on the base of has class in jquery 
Javascript :: créer composant react 
Javascript :: open bytes in new tab angular 
Javascript :: adding preview images to react apps for linkedin 
Javascript :: append string in variable using jquery in each loop 
Javascript :: predicate logic solver 
Javascript :: renderer.setElementStyle 
Javascript :: mongodb install err npm 
Javascript :: srcset vue 
Javascript :: cypress read xml file 
Javascript :: imagebackground with input inot avoiding react native 
Javascript :: how to pass property component in react enzyme 
Javascript :: what is steal.js 
Javascript :: JS truthy value of void 
Javascript :: complex type in javascript and memory allocation 
Javascript :: how to query chain an id in an id javascript 
Javascript :: useEffectOnce 
Javascript :: add delay for keypress event in extjs 
Javascript :: filter keys from object using ramda 
Javascript :: AWS SDK for javascript assumerole with proxy 
Javascript :: js queryselector get elements with empty attribute 
Javascript :: javascript write to text file stack overflow 
Javascript :: react set multible attribute values 
Javascript :: giving the date in protractor 
Javascript :: when chrome loads data it resets scroll 
Javascript :: which node primary pacemaker of heart 
Javascript :: console log update status bar 
Javascript :: slack icon emoji for alertmanager 
Javascript :: javascript picture delete after time 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =