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?