In this part, you will:
•Save changed data back to file using a control action
•Run a simulation to test the success of the Save to File action
You can specify that a change made by editing the combo box is saved back to file. Since the source node of the combo box is the Selection element, any change made to the combo box selection will be saved to this element. To specify that any change is saved back to the Selection element in the default file, we will add the Save action to the OnFinishEditing event of the combo box. Do this as follows:
1.Right-click the combo box and select Control Actions for OnFinishEditing from the context menu.
2.This displays the Control Actions dialog for the combo box, which already has the Reload action that targets the image.
3.Drag the Save action into the OnFinishEditing pane, and drop it below the Reload action (see screenshot below).
4.Open the action's Edit XPath Expression dialog, and enter $XML1 as the source to which the data should be saved (see screenshot below).
5.Click OK to finish, and then save the file.
6.To test whether the change is saved to the default file, open the default file in an editor, run a simulation, select a combo box entry, and then reload the default file in the editor. The new combo box selection will appear as content of the Selection element in the default file.
|Note:||If you wish to save to some file other than the default file, use the Save to File action (instead of the Save action). If you wish to save to a web page, use the Save to HTTP/FTP action. (In this case, you will also need to provide the authentication details that allow the user to modify the page at the HTTP URL.)|