User 7f33ec9a5c
19-11-2015 05:47:37
Hi,
I am testing the MarvinJS and find that in IE 11.0 it returns an empty string instead of molfile. The JS to retrive the molfile to a hidden field works perfectly in Chrome, Safari, etc... but in IE 11.0 it just returns an empty value for either the mrv or molfile format.
My JS is posted below.
<script type="text/javascript">
//this is how we refer to the Marvin JS object.
var marvinSketcherInstance;
$(document).ready(function(e) {
var promise = MarvinJSUtil.getEditor("#sketch");
promise.then(function (sketcherInstance) {
marvinSketcherInstance = sketcherInstance;
RepaintChemdrawFromCache();
}, function (error) {
alert("Cannot retrieve sketcher instance from iframe:" + error);
});
$("[id$='form1']").submit(GetChemdrawData);
});
function ApplyMol(sMol) {
SetMarvinJSdata('mol', sMol);
}
function GetChemdrawData()
{
GetMarvinJSdata('hidMOL', 'mol')
GetMarvinJSdata('hidCDXcache', 'mrv') //Cache structures so Drawing applet supports structure display over postbacks.
}
function GetMarvinJSdata(dest, type)
{
var $dest = $("[id$='" + dest + "']")
marvinSketcherInstance.exportStructure(type).then(function(source) {
$dest.val(source);
}, function(error) {
alert("Molecule export failed:"+error);
});
}
function SetMarvinJSdata(type, structure)
{
marvinSketcherInstance.importStructure(type, structure).catch(function (error) {
alert(error);
})
}
function RepaintChemdrawFromCache()
{
//`function so that the Chemdraw control maintains it's structure drawing
// during postback so UserValidation of form does not result in having
// the structure cleared on every submit.
try
{
var sCDX = $("[id$='hidCDXcache']").val();
if (sCDX.length > 0)
SetMarvinJSdata("mrv", sCDX);
}
catch(err){}
}
</script>