I have a design provided by the customer, where the search block form has no SUBMIT button. It is expected the user just hits the "enter" key.

Users can type keywords into the search box, and when they press "enter," the form is submitted. The problem is that the form is submitted always with "#default_value" and never with the keywords typed into the input box.

On the advanced search page/results the search does work.

Does anyone know why this might be?

We have hidden the submit button via a CSS call of display: none.

share|improve this question

1 Answer

Are you using the <form>'s submit event rather than the <input>'s click event to respond to the form submission? Check out this working example on jsFiddle.

$("#form").bind('submit', function(e) {
    var $div = $("<div>Transmitting</div>").appendTo('body');
    $.ajax({
        url: '/ajax_html_echo/',
        data: {html: $("#html").val() },
        type: 'POST',
        success: function(data) {
            $div.html("Received: "+data);
        }
    });
    return false;
});
share|improve this answer

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.