In the past, we have suggested a few workarounds using Java script to attain some functionality which wasn't there at that time. We introduced a application setting named "Set XSS Security level" with values High/Low to enable the support for HTML tags and Java script. We have also decided to remove the "Set XSS Security level" option and indeed provide a "Allow HTML" option for users who wants to format the data with HTML tags.
Now, we have implemented a proper solution for those workarounds suggested with Java script. We have listed few of the Java script use cases and suggestions for changing it to a proper implementation.
1. Adding values to existing lookup field :
Adding a new option to the existing drop-down is done with the parent form which has the values for the look-up field. The workaround suggested for this requires a "Add Notes" field having an anchor(<a>) tag. On clicking the link, the users will be shown a form(parent) to enter the new option. On submitting, the parent form closes and the child form reloads to reflect the new option in the drop-down. This is achieved by writing a onClick script in the anchor tag as shown below.
For instance, consider a form named "Countries" with "Name of the Country" as the single line field. This field is looked up into "Contact Details"(as Country) form as a single select. While entering the data for "Contact Details", a new country can be added as an option in the "Country" look-up. This is done by writing the below shown Java script code in the pain text field.
The code above will open the parent form in a new window where the user could add the new option. On submission, the form will close and the "Contact Details" form will reload to reflect the new option in the the "Country" lookup.
Suggested Implementation :
The new implementation also involves the use of plain text field but instead of Java script the URL option will be provided. The sample code is shown below :
<a href="#Form:Countries?zc_LoadIn=dialog&zc_NextUrl=Form:Contact Details">Add a Country</a>
Just changing the anchor tag is enough to replace the workaround with proper implementation. The support for adding new option to existing lookup fields is provided in this way.
2. Using formula fields to open a link in new window :
In the past, users were required to open a form or web page on clicking a link in the records of a view. For this, we have suggested the use of formula fields to construct the link using anchor tags. Plain web pages are linked with the href attribute itself. But in some cases users were required to open a form for updating values of the record. In this case, Java script was used for the onclick action of the link constructed with the formula field. This Java script is similar to the one used in the form(shown above).
The end result of the formula will be a anchor tag shown below :
For normal web page :<a href="http://www.zoho.com" target="blank">Zoho</a>
Suggested Implementation :
This can be solved by following the same approach done for the form. The formula field should be constructed as shown below :
<a href="#Form:Contact_Details?zc_LoadIn=dialog&zc_NextUrl=View:Contact_Details_View">Change Contact</a>
We request you to change the workaround to a proper implementation as soon as possible. Please get back to us if you have any difficulty in doing this. We will do the modifications for you. Also post your comments if you have any other use case involving Java script.
Our support email address : firstname.lastname@example.org
Toll Free Number : +1-888-900-9646