Hi all I am attempting to use a form_alter to add a confirmation page to the node edit/add form. I am able to use the following basic structure to get things working however when I use confirm_form with the existing $form variable from within the form_alter I end up getting the entire original form reprinted and the confirmation text and buttons are simply edited into this form.
What I am hoping to do is use would click "save" on the add/edit node form and then a confirmation screen would come up asking if the user is sure they wish to proceed, if they click continue I would want the form to b submitted as normal, if they choose cancel return back to the node add/edit form and for their change/addition to not be saved. Has anyone done this and if so how?
Below is a snippet of to show what I have so far.
<?php
function lb_registrations_form_lb_event_node_form_alter(&$form, &$form_state) {
if(!isset($form_state['storage']['confirm'])) {
$form['#validate'][] = 'lb_registrations_check_registrations';
$form['#submit'][] = 'lb_registrations_create_regid';
}
else {
$form = confirm_form($form,'Are you sure you wish to continue?',substr($form['#action'],1),'Proceed with caution','Yes, proceed','Cancel');
}
}
function lb_registrations_check_registrations(&$form, &$form_state) {
if(!isset($form_state['storage']['confirm']))
{