2011-04-25 42 views

回答

2

你可以通过jQuery检查提交...

$('form').submit(function(event) { 

    // These are the values returned by AutoComplete 
    var matches = ['a', 'b', 'c']; 

    // Assuming Array.indexOf(), otherwise extend the prototype 
    if (matches.indexOf($('input').val() == -1) { 
     event.preventDefault(); 
    } 

}); 

请记住,这仅仅从提交停止一个JavaScript启用的用户。禁用它的用户将提交它就好了。

+0

@Nikita如果他们不能在输入字段中输入文本,会自动完成工作吗? – alex 2011-04-25 02:35:46