javascript - Object required error Java Script -
i have problem below code use jira. when run code,
object required error @ line 4
could please help! values approver , assigne right there no problem them
<script type="text/javascript" charset="utf-8" id="prioritycustomfieldscript"> //utils(common) var by_id=function(n){ var i=document.getelementbyid(n); return { //error line value:i.value, set_value:function(v){i.value=v;} }; }; function setsummaryandsubmit(e){ e.preventdefault(); e.stoppropagation(); //utils var id_set=function(n){ var v={}; v.a=function(x,y){v[x]=y;return v;}; v.g=function(){return v[by_id(n).value] || '';}; return v; }; //approver var by_id_11690=id_set('customfield_11690'). a('22468','205 ssnl sap'); //assignee var by_id_11690_1=id_set('customfield_11690:1'). a('22469','jpechea'). a('22470','amikusi'); var setter=(function(){ var d=new date(); by_id('customfield_10146').set_value(d.getfullyear()); by_id('summary').set_value('adi - ' +by_id('customfield_10146').value+' - ' +document.getelementbyid("customfield_10171").options[document.getelementbyid("customfield_10171").selectedindex].text+' - ' +by_id_11690.g()+' - ' +by_id('customfield_10163').value); //by_id('assignee').set_value(by_id_11690_1.g()); by_id('assignee-container').set_value(by_id_11690_1.g()); var selectedglobalid; selectedglobalid=document.getelementbyid('assignee-container').value; jquery("#assignee").find('option').remove(); jquery("#assignee").append("<option value='" + selectedglobalid +"'>jira user</option>"); jquery("#assignee").val(selectedglobalid).attr("selected", "selected"); }()); //ok //var form=this; //form.submit(); jquery("#customfield_10146").parents('form').submit(); } jquery(document).ready(function($) { function hidesummaryandaddseverityhook(){ var row = document.getelementbyid("assignee-container"); if (row) { row.style.display = 'none'; } $('#customfield_10146').closest('div.field-group').hide(); $('#summary').closest('div.field-group').hide(); jquery("input#issue-create-submit").click( function(event) { setsummaryandsubmit(event);}); jquery("input#issue-edit-submit").click( function(event) { setsummaryandsubmit(event);}); } var currentlocation = window.location.href; if (currentlocation.indexof('createissue') > -1 || currentlocation.indexof('editissue') > -1) { hidesummaryandaddseverityhook(); jira.bind(jira.events.new_content_added, function (e,context) { hidesummaryandaddseverityhook(); }); } }); </script>
document.getelementbyid()
returns null if no element found - need check in code. error you're getting means isn't object - document.getelementbyid()
returned null in 1 of calls.
Comments
Post a Comment