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:
First of all, set up the Dreamweaver environment:
The database used in this tutorial is the same one used in the How to check if username already exists using web services tutorial. To learn where to find the .sql and .mdb scripts and to read about its structure, click here.
Create a new page in one of your sites (used for testing/learning), in the root, and name it state_redirect.
Open the state_redirect file and define a new Dreamweaver database connection: conn_redirect. Configure it to connect to your database server and make it point to the database containing the table described earlier.
Create an AJAX panel in the state_redirect file as explained here (steps 1-4), with a few differences:
In the Basic tab, name the panel Redirect and have the filename automatically generated.
In the Styles tab, select the Rounded corners style.
In the States tab, add two more states besides the default one: Register and ThankYou. Leave the automatically generated filenames.
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.
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).
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.
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). |