tags:

views:

58

answers:

2

Hello all,

I am trying to raise a click event on a submit button in a html form. I use the .click() jquery to catch the click event and return true at the end of the function. When I click on the submit button, the jquery functions are raised and a callback is executed, but the $_POST array is empty.

How can I fix this?

code:

<form action="index.php?p=searchexlibris&amp;t=palabre" method="post" id="frmSearchexlibris">
<input type="text" name="palabre" id="palabre" value="" /> 
<input class="searchbutton" id="exlibrisbutton" type="submit" value="Buscar" />
</form>

In javascript functions: $('#exlibrisbutton').click(function(){ enableDisableFormExlibris('exlibrisbutton',false); return true; });

In the function that catches the submit I get an empty $_POST, while the post works when I dont call the javascript function.

+2  A: 

What you may be meaning to do is listen to the submit event of the form itself. Try .submit() http://api.jquery.com/submit/

Edit: However, the .click() callback does occur before the form is submitted, so the problem could be in the manner in which you are setting your inputs.

Fletcher Moore
+2  A: 

If you disable input fields and such in your javascript function before the data gets posted, it simply doesn't put the values of the disabled input fields in the $_POST array.

One possible way to solve this would be sending them manually.

Arsenal
oh, ok.That seemed to be the problem!Thank you :)