Note that there are some explanatory texts on larger screens.

plurals
  1. PODrupal Multistep Node Form Prevent Save If not on last step
    primarykey
    data
    text
    <p>Trying to change the node/add form for a specific content type to a multistep form.</p> <p>(drupal6, cck dev 3x (for multigroup) )</p> <p>What I can't wrap my head around is how to prevent the form from actually creating a node on the step 1 submission and transition to step 2.</p> <p>No possibility of step being 2 right now, but I can't figure out how to prevent the save.</p> <p>I have tried the following:</p> <p>putting $form["#submit"] = array() and then adding my ["#submit"] handler (this doesn't work, it still gets saved)</p> <p>Have also tried just blank returns which fire but still cause the node to be saved.</p> <pre><code>* HOOK FORM ALTER */ function armormod_form_alter(&amp;$form, $form_state, $form_id) { //print_r($form); //print_r($form_state); //print_r($form_id); if($form_id = "seed_node_form") { //set the default step if(!isSet($form_state["storage"]["step"])) { $form_state["storage"]["step"] = 1; } // Add an after_build function to process when everything's complete. $form['#after_build'][] = 'armormod_after_build'; /* clear the submit (this doesn't work) Normally calls menu_node_form_submit and then upload_node_form_submit */ //$form["#submit"] = array(); $form["#submit"][] = "armormod_submit"; $form["#validate"][] = "armormod_validate"; } } function armormod_submit($form, &amp;$form_state) { if($form["form_id"]["#value"] == "seed_node_form") { if($form_state["storage"]["step"] &lt; 2) { drupal_set_message("Form Step:".$form_state["storage"]["step"]); return; } } else { return $form; } } function armormod_validate($form, &amp;$form_state) { if($form["form_id"]["#value"] == "seed_node_form") { drupal_set_message(t("Validation Called"), "status"); return; } else { return $form; } } /* AFTER BUILD LETS US MODIFY CCK FORM ELEMENTS */ function armormod_after_build($form, &amp;$form_state) { if($form["form_id"]["#value"] == "seed_node_form") { if($form_state["storage"]["step"] == 2) { drupal_set_message(t("Step 2 Build Called"), "status"); $form["group_statistics"]["#access"] = 1; $form["buttons"]["submit"]["#value"] = "Save"; } else { drupal_set_message(t("After Build Called"), "status"); //hide statistics group $form["group_statistics"]["#access"] = false; $form["buttons"]["submit"]["#value"] = "Next Step"; unset($form["buttons"]["preview"]); //print_r($form); } } return $form; </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload