tags:

views:

14

answers:

2

Hi, I have a form wizard and need to block the user from moving from step 1 to step 2. It's easy enough to do this with validation, but this isn't a requirement, just a warning if a certain combination of boxes is checked. I have it working to a point, unfortunately it doesn't stop the user from moving from step 1 to step 2 and displays the alert on step 2. Ideally it would display the alert/confirm dialogue on step one and only allow the user to go to step 2 if they select ok, selecting cancel would close box and remain on that page. Can anyone help out here? Much appreciated. And now, the code:

$("#step0Next").live('click', function(event) {
if($("#RT").is(":checked") && !$(".ex").is(':checked')) { 

alert("You have not selected any exchanges for which to receive real time market data from. If
you continue, you will only receive real time data for market metrics and ten minute delayed
data for everything else. Do you wish to continue?"); 
$(this).die('click');
} 
});

so if a user checks "#RT" and no boxes with a class of .ex are checked, it goes to step 2 and displays the alert. I will replace alert with custom jConfirm box. Thanks,

A: 

Sounds like you need a confirm box - see here: http://www.w3schools.com/js/js_popup.asp

Mike Robinson
http://www.kinetick.com/Test/purchaseTest$("#step0Next").live('click', function(event) { var ask = confirm("Do You Really Want To Continue"); if($("#RT").is(":checked") } });still doesn't prevent the "default" of hitting #step0Next and going onto next step. on second step it displays the confirm
Dirty Bird Design
A: 

@Nick Craver - thanks man.

<script type="text/javascript">
    $("#step0Next").live('click', function(event) {
        $('#step1Prev').click();  //go back to step 1
        if($('#RT').is(':checked') && !$('.ex').is(':checked')) {
            if(!confirm("You have not selected any exchanges for which to receive real time market data from. If you continue, you will only receive real time data for market metrics and ten minute delayed data for everything else. Do you wish to continue?")) return;
            $('#step0Next').die('click');
        }
    $(this).triggerHandler('click');
    });
</script>
Dirty Bird Design