I am submitting the form from the javascript function. Only one function in my javascript file contains the submit function call.
Also I am not using any buttons in the form. It contains an image.
WHy I find it strange is, the page works fine on click of the image - it calls the validation functions and if everything is proper, then submits the page. But when I press enter, the page gets submitted without calling any of the javascript functions. I am capturing the key events on the document and if the key pressed is "Enter" I am calling the validation function. The validation function returns true if the form field is NOT NULL. Returns false if it is empty. If true is returned, the page should get submitted. If false is returned, the page should NOT get submitted and it should return focus to the respective form field.
This is not happening on enter press.
The same page works fine when I click on the image for submitting the page.
When I press "Enter" though the validation function is called, the page gets submitted in the background which I can see while the alert is displayed.
All these things happen only if the page contains a single text box. If it has more than one textbox, everything works fine - ALL THE FUNCTIONS AND LOGIC IS THE SAME IN ALL PAGES - ALL THE JAVASCRIPT FUNCTIONS ARE IN A SINGLE JS FILE.
Please help..