How to redirect to another panel state after submitting a form

Say in an AJAX panel state you built a record insertion or update form with the default Dreamweaver commands. If after submitting the form you want to redirect to another state in the same panel, you have to use the AJAX Redirect server behavior (the default "redirect" from Dreamweaver does not work with AJAX panel states).

Note: If you build the record insertion or update form with the MX Kollection (Standard or Pro) commands, the AJAX Redirect server behavior is not needed. You can specify the redirect page in the dialog box, more precisely, you can specify the panel state to which to redirect: index.php?PanelName__state=StateName. For more details about the URL corresponding to an AJAX link, check out this note.

 

To build inside an AJAX panel state a form that after submitting will redirect you to another state of the same panel, follow the steps below:

  1. First of all, set up the Dreamweaver environment:

  2. Create an AJAX panel in the state_redirect file as explained here (steps 1-4), with a few differences:

  3. Edit the ThankYou state from the Redirect panel. Access it by using the Edit Panel States button in the Insert bar:


                                            
    Remove all the sample text (press Ctrl+A, and then Delete) and enter the following line: Thank you for registering on our site! Save the panel state and then switch to the Register one, as shown above.

  4. Remove the "Redirect :: " part from the title, as well as the sample text below the title (triple-click in that paragraph to select it, and then press Delete).

  5. In the empty paragraph below the title apply the Record Insertion Form Wizard as shown here,  the only difference being the database connection - conn_redirect here. Make sure not to enter any URL in the After inserting, go to text box.

  6. After the registration form was created, apply the AJAX Redirect server behavior from the Application panel, Server Behaviors -> + -> MX AJAX Toolbox. Configure the dialog box that opens as shown below:

 
Save and upload the state_redirect page to the server. Press the Preview in Browser button from the Insert bar to test the Register state:


 
After filling out the form and pressing the Insert record button, you will be redirected to the ThankYou state:

 

Notice the URL parameter passed: ...state_redirect.php#Redirect__state=ThankYou.

See how easy it was to redirect to another panel state after submitting a form by using the AJAX Redirect server behavior!

Gabriel  Antal
08-28-2006

Question:

The ajax redirect doesn't work if you use it with a form that has a file field (at least whyle using an interakt insert/upload form).

My scenario:

URL of the form: "index.php#Content__state=the_form"

In the form wizard, I've inserted in the "After updating, go to:" field the followind: "index.php?Content__state=the_updated_result"

What's happening is that after the upload, the address changes to "index.php?Content__state=the_updated_result"

Any ajax links clicked after this action would put the "#Content__state=panel_name" after the above mentioned link so, the result would look like this: "index.php?Content__state=the_updated_result#Content__state=panel_name"

Just wanted to let you know.

Regards,

Gabriel ANTAL

Answer:

The AJAX Redirect server behavior only works with Dreamweaver's default insert and update forms. For insert and update forms created with other InterAKT externsions, you should specify the state to be redirected to as index.php?Content__state=the_updated_result

(Please replace index.php, Content and the_updated_result with the appropriate names for your situation).