<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 10pt; color: #000000'>I submitted this issue here: http://drupal.org/node/387674, but I really need a response. I think this may be a bug, but I can't be sure right now. Need some advice.<br><br><p>I have created a form. I want to submit the form values, validate
them, then confirm that the user wishes to proceed. I place a
drupal_execute('confirmation_form', $form_values) in my submit hook,
and in the 'confirmation_form' I execute "confirm_form". But, it
doesn't work. I don't get a confirmation form: the code execution
cycles through to conformation_form_submit.</p><p><br></p>
<p><b>form()</b><br>
Input values</p>
<p><b><br></b></p><p><b>form_validate()</b><br>
validate values</p>
<p><b><br></b></p><p><b>form_submit()</b><br>
Now, I want to confirm that the user wants to continue. If I call a
form from within this submit hook that executes a confirm_form, the
confirm_form() function doesn't work</p>
<p><b><br></b></p><p><b>form_confirm()</b><br>
Execute confirm_form() doesn't work.</p>
<p><br></p><p>Code example:</p><p><br>
</p><div class="codeblock"><code><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"><?php<br></span><span style="color: rgb(0, 119, 0);">function </span><span style="color: rgb(0, 0, 187);">og_user_roles_register_submit</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$form</span><span style="color: rgb(0, 119, 0);">, &</span><span style="color: rgb(0, 0, 187);">$form_state</span><span style="color: rgb(0, 119, 0);">) {<br> global </span><span style="color: rgb(0, 0, 187);">$user</span><span style="color: rgb(0, 119, 0);">;<br> <br> if (</span><span style="color: rgb(0, 0, 187);">$user</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">uid</span><span style="color: rgb(0, 119, 0);">) {<br> </span><span style="color: rgb(0, 0, 187);">$regcode </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">$form_state</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'values'</span><span style="color: rgb(0, 119, 0);">][</span><span style="color: rgb(221, 0, 0);">'og_user_roles_regcode'</span><span style="color: rgb(0, 119, 0);">];<br> </span><span style="color: rgb(0, 0, 187);">$gid </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">og_user_roles_gid_from_regcode</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$regcode</span><span style="color: rgb(0, 119, 0);">);<br> if (</span><span style="color: rgb(0, 0, 187);">$gid </span><span style="color: rgb(0, 119, 0);">> </span><span style="color: rgb(0, 0, 187);">0</span><span style="color: rgb(0, 119, 0);">) {<br> </span><span style="color: rgb(0, 0, 187);">$node </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">node_load</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$gid</span><span style="color: rgb(0, 119, 0);">);<br> </span><span style="color: rgb(0, 0, 187);">drupal_execute</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'og_user_roles_register_confirm'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$form_state</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$regcode</span><span style="color: rgb(0, 119, 0);">);<br> }<br> } else {<br> </span><span style="color: rgb(0, 0, 187);">drupal_access_denied</span><span style="color: rgb(0, 119, 0);">();<br> }<br>}<br><br></span><span style="color: rgb(255, 128, 0);">/**<br>* Form builder; Builds the confirmation form for adding user to group using regcode.<br>*<br>* @ingroup forms<br>* @see og_user_roles_register_confirm_submit()<br>*/<br></span><span style="color: rgb(0, 119, 0);">function </span><span style="color: rgb(0, 0, 187);">og_user_roles_register_confirm</span><span style="color: rgb(0, 119, 0);">(&</span><span style="color: rgb(0, 0, 187);">$form_state</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$regcode</span><span style="color: rgb(0, 119, 0);">) {<br> </span><span style="color: rgb(0, 0, 187);">$form </span><span style="color: rgb(0, 119, 0);">= array();<br> </span><span style="color: rgb(0, 0, 187);">$form</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'#node'</span><span style="color: rgb(0, 119, 0);">] = </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">;<br> </span><span style="color: rgb(0, 0, 187);">$form</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'#regcode'</span><span style="color: rgb(0, 119, 0);">] = </span><span style="color: rgb(0, 0, 187);">$regcode</span><span style="color: rgb(0, 119, 0);">;<br> return </span><span style="color: rgb(0, 0, 187);">confirm_form</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$form</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Are you sure you want to join this group %title?'</span><span style="color: rgb(0, 119, 0);">, array(</span><span style="color: rgb(221, 0, 0);">'%title' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">title</span><span style="color: rgb(0, 119, 0);">)), </span><span style="color: rgb(221, 0, 0);">'node/'</span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">nid</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'This action can only be undone by unsubscribing from the group once joined.'</span><span style="color: rgb(0, 119, 0);">), </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Delete'</span><span style="color: rgb(0, 119, 0);">), </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Cancel'</span><span style="color: rgb(0, 119, 0);">), </span><span style="color: rgb(221, 0, 0);">'og_user_roles_register_confirm'</span><span style="color: rgb(0, 119, 0);">);<br>}<br></span><span style="color: rgb(255, 128, 0);">// Confirmation form does NOT display. Code continues to successfully execute<br>// og_user_roles_register_confirm_submit()<br>//<br>// It's like if a form is called from a successful submit, then it's subsequent submit hook is<br>// automatically successful as well.<br></span><span style="color: rgb(0, 0, 187);">?><br><br></span></span></code></div>
<p>In all the working examples of confirm_form() I've seen in Drupal
6.x, I do not see an example where it is called from a form submit
hook. Usually, it is called in some delete function where the key value is passed along in the url.<br></p><p><br></p>
<p>I want to enter values, validate those values, then confirm that the
user wishes to proceed. How do I do that using confirm_form() (if
that's even possible)?</p><br>Thanks for any assistance.<br><br>-ron<br><br></div></body></html>