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.
// 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
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://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>
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"));
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.