I'm wondering if I can add a cancel link beside the submit button without hacking the core files of GF. Is there a hook I can call? Should I use the gform_submit_button hook?
I'm wondering if I can add a cancel link beside the submit button without hacking the core files of GF. Is there a hook I can call? Should I use the gform_submit_button hook?
What do you want the cancel link to do? Just close a window or link to another page?
Depending on what you want to do, you can just add a link with some jQuery.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#gform_wrapper_XX .gform_footer input.button").after("<a href='#' id='cancel-link'>cancel</a>");
});
</script>
where XX is your form id. If you're already loading jQuery in your theme, you can omit the script reference.
Thanks Kevin.
I updated your script to work with the jQuery conflict in WordPress.
<script type="text/javascript">
var $j = jQuery.noConflict();
$j("#gform_wrapper_XX .gform_footer input.button").after(" <a href='#' id='cancel-link'>Cancel</a>");
</script>
Good idea, thanks for posting the update. I left out the non-breaking spaces in my example and opted to use CSS to position the link. Either work fine I suppose..