1

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.

1

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;
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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