Title: OnClick Event format?
Last modified: March 1, 2019

---

# OnClick Event format?

 *  Resolved [amcanulty](https://wordpress.org/support/users/amcanulty/)
 * (@amcanulty)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/)
 * Is the OnClick Event a script or html or other? For example, I want my OnClick
   Event on the button to take the user to a page and nothing is happening. I’ve
   tried variations of these in the OnClick Event box:
 * `<input type=button onClick="location.href=https://rmxassociation.org">`
    -  This topic was modified 7 years, 3 months ago by [amcanulty](https://wordpress.org/support/users/amcanulty/).
    -  This topic was modified 7 years, 3 months ago by [amcanulty](https://wordpress.org/support/users/amcanulty/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/#post-11263768)
 * Hello [@amcanulty](https://wordpress.org/support/users/amcanulty/)
 * The code in your ticket has some erros, the correct one would be:
 *     ```
       <input type="button" onclick="document.location.href='https://rmxassociation.org';" value="Click Here" />
       ```
   
 * Please, note that you are not submitting the form, you are redirecting the users
   to another page, the concepts are differents.
 * Best regards.
 *  Thread Starter [amcanulty](https://wordpress.org/support/users/amcanulty/)
 * (@amcanulty)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/#post-11263800)
 * Thank you for such a quick response! Correct, I don’t want to submit the form,
   I want the button to take the user to a defined page.
 * It still isn’t working. I’m testing from the plug-in’s own Preview page, perhaps
   this is visual-only and the link won’t work until it’s on a live page?
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/#post-11263827)
 * Hello [@amcanulty](https://wordpress.org/support/users/amcanulty/)
 * The button should work in both the form’s preview and live website, but I cannot
   be totally sure about what are you doing from your side without checking the 
   form in action.
 * Could you insert the form in a page and send me its URL, please?
 * Best regards.
 *  Thread Starter [amcanulty](https://wordpress.org/support/users/amcanulty/)
 * (@amcanulty)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/#post-11263843)
 * [`https://rmxassociation.org/test/`](https://rmxassociation.org/test/)
 * rmxassociation.org/test/
    -  This reply was modified 7 years, 3 months ago by [amcanulty](https://wordpress.org/support/users/amcanulty/).
    -  This reply was modified 7 years, 3 months ago by [amcanulty](https://wordpress.org/support/users/amcanulty/).
    -  This reply was modified 7 years, 3 months ago by [amcanulty](https://wordpress.org/support/users/amcanulty/).
 *  Thread Starter [amcanulty](https://wordpress.org/support/users/amcanulty/)
 * (@amcanulty)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/#post-11263855)
 * I’m not able to paste links due to moderator. But the link is at rmxassociation
   dot org slash test
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/#post-11263889)
 * Hello [@amcanulty](https://wordpress.org/support/users/amcanulty/)
 * The issue is simple, you are using a button control, so, in the attribute for
   the onclick event, in the field’s settings, you simply should insert the piece
   of code corresponding to the onclick event:
 *     ```
       document.location.href='https://rmxassociation.org';
       ```
   
 * and not the complete input tag.
    Best regards.
 *  Thread Starter [amcanulty](https://wordpress.org/support/users/amcanulty/)
 * (@amcanulty)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/#post-11263900)
 * Brilliant, works now. Thank you for your speed and attention, much appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘OnClick Event format?’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

## Tags

 * [onclick](https://wordpress.org/support/topic-tag/onclick/)

 * 7 replies
 * 2 participants
 * Last reply from: [amcanulty](https://wordpress.org/support/users/amcanulty/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-event-format/#post-11263900)
 * Status: resolved