[SalesForce] actionFunction not working in Customer Portal

I'm using actionFunction in a few Visualforce pages to call a custom save method. Although it works perfectly in regular Salesforce, it does nothing in the customer portal. If I instead call the method from a commandButton, it works OK. I already checked the debug logs, and with actionFunction, the method is not even reached.

Markup:

<apex:commandButton onmouseup="j$.Watermark.HideAll(); Save();" value="Save" />
<apex:actionFunction name="Save" action="{!saveRecord}"/>

In case you're wondering about the Watermark.HideAll(), I've already checked that it is not the problem. Removing it doesn't change anything, but calling the method directly from the commandButton works.

Any ideas why?

[Update]:
Thanks to Steven's question, I tested it across browsers: it works in Chrome and doesn't work in Firefox and IE. Now, I'll strip the page of most other elements and test actionFunction with a simple form. I'll update soon.

[Update 2]:
I answered my own question below with vital input from Mark Pond.

Best Answer

Adding my earlier comment as an answer.

What is happening here is that the button click is calling the action function (which is a form post), which is immediately followed by the normal button click behavior which is also a form post.

Your button's JavaScript onmouseup needs to return false in order for the secondary form post to not occur.

Try this: <apex:commandButton onmouseup="j$.Watermark.HideAll(); Save(); return false;" value="Save" />

Related Topic