function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric_SantiagoEric_Santiago 

Definitive Dojo Documentation

Is there any definitive documentation on using the Dojo Toolkit (http://dojotoolkit.org) in Salesforce Scontrols?

There is a small mention about Dojo in the AJAX Toolkit document (http://www.salesforce.com/us/developer/docs/ajax/index.htm). Other posts in this forum have mentioned that Salesforce now hosts version 0.4.1 of the Dojo toolkit. However, there is little documentation to be found on the paths necessary to call the required files.

I'd like to create an scontrol that uses the Dojo Editior (http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/advanced-editing-and-display/editor-rich-text) to give the user WYSIWYG controls for a text area.

Code:
<script src="/js/dojo/0.4.1/dojo.js"></script> 
<script type="text/javascript">
  dojo.require("dijit.Editor");
  dojo.require("dojo.parser");
</script>
<script src="/soap/ajax/8.0/connection.js"></script>

.....

<textarea dojotype="dijit.Editor" stylesheets="/js/dojo/0.4.1/resources/dojo.css"> <p>
  This editor is created from a textarea .
 </p>
</textarea>

 Unfortunately, its hard to find out A) what is the latest version of the toolkit Salesforce is hosting/supporting and B) what are the proper relative urls for dojo.js and dojo.css.

I'd greatly appreciate any assistance. I'll even offer to add this information and working code to the Wiki to pay it forward.



Message Edited by Eric_Santiago on 02-28-2008 10:39 AM
DavserDavser
The only thing I've seen are the Dojo examples (2) in the Ajax Tools 1.4 release. I am amazed there isn't more information on this. Any pointers to documentation would be greatly appreciated.
cheenathcheenath
Dojo 0.9 is available in sfdc. You can find it at:

/js/dojo/0.9/dojo/dojo.js




Eric_SantiagoEric_Santiago
Thank you both for these crucial bits of information. Knowing that Dojo had been upgraded I was able to look at the directory structure on the toolkit website. Likewise using the ajax toolkit I was able to test and verify my code. Here is a proof of concept scontrol control that will display a working WYSIWYG text editor orver a text area.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Editor Demo</title>
<style type="text/css">
@import "/js/dojo/0.9/dijit/themes/tundra/tundra.css";
@import "/js/dojo/0.9/dojo/resources/dojo.css"
</style>
<script src="/soap/ajax/10.0/connection.js"></script>
<script type="text/javascript" src="/js/dojo/0.9/dojo/dojo.js"
djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dijit.Editor");
</script>

</head>
<body class="tundra">
<form method="post">
<textarea name="field" width="200px" dojoType="dijit.Editor">
        It was a dark and stormy night.  Your story belongs here!
</textarea>
<input type="submit" value="Save" />
</form>
</body>
</html>

 All that would need to be done is to implement functions to pull the necessary field from an object and write the formatted value back. Anyone care to take a stab at that? In any case, more advanced options for the editor can be found at http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/advanced-editing-and-display/editor-rich-text .



Message Edited by Eric_Santiago on 03-18-2008 03:43 PM