2

jquery Impromptu popup を使用して、フォームを作成しました。しかし、問題は、送信する前にユーザー入力を確認したいということです。出来ますか。ここでは、ユーザーが 2 番目の画面でオプションを選択した場合、その値
に基づいて別のポップアップを呼び出したいと考えています。出来ますか。

var my_states = {
state0: {
    title: 'Name',
    html:'<label>First <input type="text" name="fname" value=""></label><br />'+
        '<label>Last <input type="text" name="lname" value=""></label><br />',
    buttons: { Next: 1 },
    //focus: "input[name='fname']",
    submit:function(e,v,m,f){ 
        console.log(f);

        e.preventDefault();
        $.prompt.goToState('state1');
    }
},
state1: {
    title: 'Check Here',
    html:'<table><tr><td><strong>Generate ODEC ID </strong></td><td>:</td><td id=\'gen_odec\' class=\'gen_odec\'>   <select name=\'select_odec\' id=\'select_odec\' class=\'select_odec\'>'+<?php echo json_encode($odecpref)?>+'</select></td></tr></table>',
    buttons: { Back: -1, Next: 1 },
    //focus: ":input:first",
    submit:function(e,v,m,f){ 
        console.log(f);

        if(v==1) {$.prompt.close();
                    return false;}
        if(v==-1) $.prompt.goToState('state0');
        e.preventDefault();
    }
},  
 };  
 $.prompt(my_states);
4

1 に答える 1

0

jQueryで「on」を使用すると、問題が解決します------このように。@ローランド・ベルトロムに感謝

$(document).on('change', '#select_odec', function(){
if($(this).val() === 'valueOfDesiredOption') {
    $.prompt.goToState('stateYouNeed');
}

});

于 2015-01-17T11:45:18.177 に答える