Matt
Matt

Reputation: 41

Submitting a form with PHP

I have an instance in which I use the event of clicking the submit button to populate a field in my form with value. But, now, I can't get the form to submit at the same time. What can I do?

http://jsfiddle.net/cmfZX/14/

Upvotes: 0

Views: 104

Answers (3)

Jason McCreary
Jason McCreary

Reputation: 73031

Your event handler returns false. Event handlers should return anything other than false or nothing in order for the default behavior to occur.

This article might be a good read for you.

Upvotes: 2

Jake A. Smith
Jake A. Smith

Reputation: 2328

That last return false is preventing the form from submitting. Once you pull that out, it should run just fine. You may also want to consider updating the form field with the JSON inside the first onclick event, that way you don't have to do anything special on submit.

Upvotes: 1

DaveRandom
DaveRandom

Reputation: 88697

Just don't return false from your form's submit handler.

http://jsfiddle.net/cmfZX/15/

Not a lot more to say than that...

Upvotes: 10

Related Questions