I was able to achieve the end result of having the gform submit in the modal footer. For anyone who uses Twitter Bootstrap, this may be helpful. I spliced the html from the modal into a submit button filter.
A normal modal would look like this:
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel" style="text-align: center;">Learn More</h3>
</div>
<div class="modal-body">
Stuff
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
but by making it this when using gforms, you can insert the gform submit into the modal footer:
<div id="myModal2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel" style="text-align: center;">Contact Us</h3>
</div>
<div class="modal-body">
<?php echo do_shortcode('[gravityform id="9" name="Contact Support" title="false" description="false"]'); ?>
</div>
and adding a filter to the submit button:
add_filter("gform_submit_button_9", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
return "
</div>
<div class='modal-footer'>
<button class='button' id='gform_submit_button_9'>Submit</button><button class='btn' data-dismiss='modal' aria-hidden='true' style='margin-right: 10px'>Close</button>
</div>";
}
This way the modal functions as it was design to. A demo can be seen on hookahi.com, there is a 'Message Us' link in the footer.
Posted 12 years ago on Thursday December 13, 2012 |
Permalink