It's possible to don't pass in GET some fields of a form?
        Posted  
        
            by avastreg
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by avastreg
        
        
        
        Published on 2010-04-08T08:32:04Z
        Indexed on 
            2010/04/08
            8:43 UTC
        
        
        Read the original article
        Hit count: 395
        
I have a form with some input texts passed in GET, and i don't want to have in GET all the fields; i want to avoid empty fields.
So, a concrete example for:
<form method="GET" action="an_url">
    <input type="text" name="field1"/>
    <input type="text" name="field2"/>
    <input type="text" name="field3"/>
    <input type="submit" value="submit"/>
</form>
I supposed that fields disabled by html attribute "disabled" shouldn't be passed to GET.
So i have done a js (based on jquery) to disable empty fields on submit, something like this:
     $("form").submit(function() {
         $(this).find("input[type=text]").each( function () {
            if (!$.trim($(this).val())) {
                $(this).attr("disabled", "true");
            }
         });
     });
However, this doesn't work. Any ideas?
© Stack Overflow or respective owner