Table of Contents
The OpenURL Deluge task can be invoked from Form and Field actions to redirect the Form to a specified URL. The URL can be opened in the same window, new window, parent window, popup window or iframe. Support for iframe provides huge opportunities for developers to improve the interface/interaction of their applications and provide Web 2.0 (AJAX) like experience to their users where parts of the Web Page can be refreshed with new data from the Server without having to repaint the entire screen space.
- Open URL is a terminal statement and will execute only the last OpenURL task when configured more than once.
// to open url in same window
openUrl("<url>", "same window")
// to open url in new window
openUrl("<url>", "new window")
// to open url in parent window
openUrl("<url>", "parent window")
// to open url in popup window
openUrl("<url>", "popup window", "height=<height>,width=<width>");
// to open url within named iframe elements on the same webpage
- URL refers to the URL string to which the form must be redirected to.
- For example, openUrl("http://www.zoho.com","new window");
- a Deluge expression using input field names, variables or functions to invoke URLs dynamically.
For example, openUrl(input.Url_Name, "new window"); where, Url_Name is the field in your form to enter the url.
- You can use the encodeURL() function to encode the url string.
- Refer the topic Using Script Builder for detailed steps to invoke the Script Builder and add the script.
- Drag-n-drop the open url Deluge task to the editor area and click on the Edit button to specify the url and window type.
- In the Open URL dialog, specify the url to redirect the form. You can also invoke the expression builder to create dynamic URLs using input field values, variables and functions.
- Select the window type to open the URL and click Done.
- Click Save Script to update the script to the form definition.
In the screen-shot given below, the open url task is added in the on add -> validate form action script. The form will be redirected to the given url, when the form is submitted for validation.
The sample application TestIFrames demonstrates some of the ways the iframe support for Open URL can be implemented within an application.
Sample view1: http://app.zohocreator.com/sampleapps/testiframes/#Page:htmlView1
The above view is a HTML view which invokes three iframes, named "frameName1", "frameName2" and "frameName3", as specified in the code below:
<iframe name="frameName1" src="https://app.zohocreator.com/sampleapps/testiframes/form-embed/TestIFrame" width="500" height="250"></iframe>
<iframe name="frameName2" src="https://app.zohocreator.com/sampleapps/testiframes/page-embed/emptyview" width="500" height="300"></iframe>
<iframe name="frameName3" src="https://app.zohocreator.com/sampleapps/testiframes/page-embed/emptyview" width="500" height="300"></iframe>
- The iframe named "frameName1" displays a stateless form named "TestIFrame" to select the frame name and the URL
- The iframe named "frameName2" and "frameName3" displays an empty page named "emptyview"
- Upon clicking the "TestIFrame" form button, the selected URL is displayed in the selected frame. The "on click" script added to the "TestIFrame" form is given below:
openUrl(input.Specify_Url, "iframe", input.Specify_Target);
The above view is a HTML view which defines an iframe named "targetTest. When the view loads, it will open the specified URL in the target frame named "targetTest".
<iframe name='targetTest' height='500px' width='500px' frameborder='0' scrolling='yes' ></iframe>
<%openUrl("https://www.zoho.com", "iframe", ("targetTest"));
- The openURL task will not be executed, if a user defined function (with the openUrl task) is invoked from a custom action that is placed in the View header and type is set as execute action for each record.
Reason: A custom action placed in the view header can be invoked on all or specific records in a view. Hence, if a custom action that executes the openURL task is invoked on all or many number of records in a view, it will open that many browser windows. A user who invokes this custom action may sometimes not be aware of the actual reason for this behavior. Hence, openURL task is not supported when the custom action is placed in the view header.
Using openURL task you can redirect a user to a Form’s view after successful submission of Form data:
Assume you have a Form named My Contacts. The link names will be My_Contact (for the form) and My_Contacts_Report (for the form report). Insert the following line of code to redirect a user to the Form’s view after successful submission of Form data,
The code is added to the On Add > On Success section of your Form (My Contacts)
If you want the same behavior after a record is edited and the Update button is clicked, place the same code in the On Edit ->On Success section of your Form.