Add a Html Links to Custom Fields

Slava Liberzon September 15, 2013

Hello,

We are working on upgrade fro version 4 to 5.2.8. We need an abililty to add link to the document which is stored in external systym to the custom field.

We have made some customization in description section of one of the custom fields, as follows:

מהות השינוי ואופן מימושו

</br>

</br>

<script type="text/javascript" language="javascript" src="http://www.xxxx/globalScripts/DM_JscriptPointers.asp">

</script>

<script>

function addDM2ReqDet() {

var From1;

var To1;

var From2;

var To2;

var MyLink;

var res;

res = SearchDocs(0);

MyLink = res;

From1 = MyLink.indexOf('DOCNUMBER');

To1 = MyLink.indexOf('/DOCNUMBER');

From2 = MyLink.indexOf('NAME');

To2 = MyLink.indexOf('/NAME');

if (To1 > 0) {

document.getElementsByName("customfield_10403")[0].value = document.getElementsByName("customfield_10403")[0].value + '<div style="text-align: right; direction: rtl; "><a href="http://www.xxxx/opendocsdocument/default.aspx?Library=RAFDOCS&DocNumber=' + MyLink.substring(From1 + 10, To1 - 1) + '&DocName=' + MyLink.substring(From2 + 14, To2 - 4) + '&NotCloseWindow=true&MatanDocName=RAF_' + MyLink.substring(From1 + 10, To1 - 1) + '" target="_blank">' + MyLink.substring(From2 + 14, To2 - 4) + '</a></br></div>';

alert(document.getElementsByName("customfield_10403")[0].value);

document.getElementsByName("customfield_10403")[0].selection.setContent("AAAA");

}

}

function addDM3ReqDet() {

alert(document.getElementsByName("customfield_10403")[0].value);

}

</script>

<input id="AddDM3ReqDet" type="button" value="Test Value" onclick="addDM3ReqDet();" />

<input id="AddDM2ReqDet" type="button" value="Attach DM File" onclick="addDM2ReqDet();" />

Press the button to add a link to a DM file.

</br>

</br>

when we are trying to pushe an "Attach DM File" button it connects to the document storage system,

but link is not created, and we get error messages as follows:

Any help will be appreciated,

Best Regards,

Slava

1 answer

1 accepted

0 votes
Answer accepted
Slava Liberzon September 16, 2013

The problem was solved by replacement of tinyMCE.getElementsById to tinyMCE. getElementsByName

Suggest an answer

Log in or Sign up to answer