Javascript: Only letters and numbers allowed
<pre><code>    function f_check_NumOrLett(form){    //Only letters and numbers allowed  

        var text = form.bucketname.value;
        alert(text);

        var filter = /^[A-Za-z0-9]+$/;
        if (filter.test(text)) {
            form.submit(); 
        } else {
            form.bucketname.select();
            alert("Only Allow letters and numbers!");
        }
    }  
</code></pre>

<p>When I use this function, alert(text) can work, but it cannot neither submit the form or alert "Only allow letters and numbers" message. It seems it didn't excute IF condition. </p>
