Support » Fixing WordPress » Javascript Causing Reload?

  • Hi,

    I have a wordpress page that has a form on it. The user fills in the first three fields then clicks on a “Calculate” button which calls a javascript function that does the calculations and populates some other form fields with the results. At least that’s how it works outside of WordPress.

    Inside WordPress, when the button is pressed the calculations are performed and the fields are populated correctly, but then all the form fields go blank and the URL changes from




    So it somehow seems to be redirecting to the same page but with both the entered and calculated form field values encoded as parameters in the URL.

    The javascript is in a separate file, and the form has no action or method defined. The call to the javascript is done like this:

    <a onclick="javascript:compute()"><button>Calculate</button></a>

    It works find outside of wordpress. I’ve tried both putting the form in the page content and in the template. It’s running on Apache and I’m using pretty permalinks.

    Any ideas? Any help or pointers in the right direction would be greatly appreciated.



  • The topic ‘Javascript Causing Reload?’ is closed to new replies.