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
- URL string to which the form must be redirected to.
For example, openUrl("http://www.zoho.com","new window");
- 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.
The sample application TestIFrames demonstrates some of the ways the iframe support for Open URL can be implemented within an application.
Sample view1: http://creator.zoho.com/sampleapps/testiframes/#View: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://creator.zoho.com/sampleapps/testiframes/form-perma/TestIFrame" width="500" height="250"></iframe>
<iframe name="frameName2" src="https://creator.zoho.com/sampleapps/testiframes/view-perma/emptyview/" width="500" height="300"></iframe>
<iframe name="frameName3" src="https://creator.zoho.com/sampleapps/testiframes/view-perma/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 HTML view named "emptyview"
- On click of the "TestIFrame" form button, the selected url is displayed in the selected frame name. 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("", "iframe", ("targetTest"));
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 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 Report 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.