Hellow,
We need to insert a table to customfield in Jira (Jira 5.2.8, jeditor 1.5.47), the isert should be initiated by pushing a button.But when the button is pushed no content is transfered to the field.Please see the code:
</br>
<script type="text/javascript" language="javascript">
function addSTDTable() {
jeditorSetData("customfield_10501", jeditorGetData("customfield_10501") + '<p dir="rtl"> </p>', {format : 'raw'});
jeditorSetData("customfield_10501", jeditorGetData("customfield_10501") + '<div dir="rtl" align="right">', {format : 'raw'});
jeditorSetData("customfield_10501", jeditorGetData("customfield_10501") + '<table dir="rtl" border="1" cellspacing="0" cellpadding="0" align="right"><tbody><tr><td colspan="5"><p dir="rtl" align="center"> </p></td></tr><tr><td><p dir="rtl"> </p></td><td><p dir="rtl"> תנאי מוקדם</p></td><td><p dir="rtl">מהות הבדיקה </p></td><td><p dir="rtl"> תוצאה צפויה</p></td><td><p dir="rtl">Pass/Fail - תוצאה בפועל (ב- STR בלבד) </p></td></tr><tr><td><p dir="rtl">1</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">2</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">3</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">4</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">5</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">6</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">7</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">8</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">9</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr><tr><td><p dir="rtl">10</p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td><td><p dir="rtl"> </p></td></tr></tbody></table></div>', {format : 'raw'});
jeditorSetData("customfield_10501", jeditorGetData("customfield_10501") + '<p><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p>', {format : 'raw'});
}
</script>
<input id="AddSTDTable" type="button" value="STD הוסף תבנית" onclick="addSTDTable();" />
</br>
</br>
<script type="text/javascript" language="javascript" src="http://www.xxx/globalScripts/DM_JscriptPointers.asp">
</script>
<script>
function addDM2STD() {
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) {
//tinyMCE.get(document.getElementsByName("customfield_10501")[0].id).setContent(tinyMCE.get(document.getElementsByName("customfield_10501")[0].id).getContent({format : 'raw'}) + '<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>', {format : 'raw'});
jeditorSetData("customfield_10501", jeditorGetData("customfield_10501") + '<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>', {format : 'raw'});
}
}
</script>
<input id="AddDM2STD" type="button" value="Attach DM To STD" onclick="addDM2STD();" />
text
</br>
</br>
With Best regards,
Slava
Hi,
The problem was solved by placing the second function before the first.
Hi Slava,
The code is correct, it works for me:
You may need to check the following:
1. Customfield id is 10501
2. function addSTDTable is defined when you click the button
3. Browser console log
4. This shouldn't affect but try to remove third arg here: jeditorSetData("customfield_10501", jeditorGetData("customfield_10501") + '<p dir="rtl"> </p>', {format : 'raw'});
It should be like this: jeditorSetData("customfield_10501", jeditorGetData("customfield_10501") + '<p dir="rtl"> </p>');
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.