Thank you for your response. By "Resolution Code is not being generated" I mean that the drop down values do not get populated and therefore, the user has no options to choose. Again, it is only an intermittent issue
Here are the first few lines of forms.js which calls the functions related to the newForm. Its not the whole code so I might be missing some parenthesis when I pasted and deleted some lines here but you will see below the relevant code.
/******************************/
/* GLOBAL /
/*****************************/
var isadmin=false;
var iscontributor=false;
var username=$().SPServices.SPGetCurrentUser();
$(document).ready(function(){
// Permissions handling
if($.cookie('c1_username') != username){
// $.cookie('c1_is_admin', null);
}
isadmin=$.cookie('c1_is_admin');
if(!$.cookie('c1_is_admin')){
setUserPerms();
}
if(isPage('DispForm.aspx')){
$('#ctl00_m_g_6fa5b9c4_c769_4474_b0c7_86f47a03c391_ctl00_ctl01_ctl00_toolBarTbl td:eq(7)').hide();
$('#ctl00_m_g_6fa5b9c4_c769_4474_b0c7_86f47a03c391_ctl00_ctl01_ctl00_toolBarTbl td:eq(8)').hide();
}
if(isPage('newServiceRequest')||isPage('servicerequests/newForm.aspx')||isPage('archive/newForm.aspx')){
assignRowAttributes();
// hide the reassign flag since we are going to control it automatically
$('.reassign_request').hide();
$('.reassign_flag').hide();
$('.case_id').hide();
$('.2nd_level_support_returned').hide();
newServiceRequestInit();
}
Here are the functions called when the condition for newForm is met above:
/******************************************************/
/* FIELD MANIPULATION /
/*****************************************************/
function assignRowAttributes(){
$('.ms-formlabel').parent().each(function(){
var label=$(this).find('h3 nobr').text();
if(label==''){
$(this).attr('title',label);
}
else{
$(this).attr('rel',label);
}
$(this).addClass(createFieldID(label));
});
}
function createFieldID(title){
var newString = title.replace(/[^a-zA-Z 0-9]+/g,'');
newString=$.trim(newString);
newString=newString.replaceAll(' ','_');
newString=newString.toLowerCase();
return newString;
}
function newServiceRequestInit(){
$().SPServices.SPCascadeDropdowns({
relationshipWebURL: "",
relationshipList: "Resolution codes",
relationshipListParentColumn: "Reason_x0020_Code",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "",
parentColumn: "Reason Code",
childColumn: "Resolution Code",
CAMLQuery: "",
listName: $().SPServices.SPListNameFromUrl(),
promptText: "Choose {0}...",
simpleChild: false, // Added in v0.6.2
selectSingleOption: false, // Added in v0.6.2
matchOnId: false, // Added in v0.7.1 completefunc: null,
debug: true
});
$('input[title="Resolution Code"]').change(function(){
$(".error").hide();
var currentval=$(this).val();
if(currentval=="Other"){
alert('Please describe the resolution method in the Problem Description field');
}
});
$('.closed_flag input').click(function(){
if($(this).attr('checked')){
$('.resolution_code input').attr('required','required');
$('tr.resolution_code nobr').append('<span class="ms-formvalidation"> *</span>');
}
else{
$('.resolution_code input').removeAttr('required');
$('tr.resolution_code nobr span .ms-formvalidation').remove();
}
});
$('select[title=Status]').click(function(){
if($(this).val()=='Closed'){
$('input[title=Resolution Code],select[title=Resolution Code]').attr('required','required');
}
else{
$('input[title=Resolution Code],select[title=Resolution Code]').removeAttr('required');
}
});
}
function isPage(URL){
if(window.location.href.toLowerCase().indexOf(URL.toLowerCase())!=-1){ return true; }
else{ return false; }
}
Here are the first few lines of forms.js which calls the functions related to the newForm. Its not the whole code so I might be missing some parenthesis when I pasted and deleted some lines here but you will see below the relevant code.
/******************************/
/* GLOBAL /
/*****************************/
var isadmin=false;
var iscontributor=false;
var username=$().SPServices.SPGetCurrentUser();
$(document).ready(function(){
// Permissions handling
if($.cookie('c1_username') != username){
// $.cookie('c1_is_admin', null);
}
isadmin=$.cookie('c1_is_admin');
if(!$.cookie('c1_is_admin')){
setUserPerms();
}
if(isPage('DispForm.aspx')){
$('#ctl00_m_g_6fa5b9c4_c769_4474_b0c7_86f47a03c391_ctl00_ctl01_ctl00_toolBarTbl td:eq(7)').hide();
$('#ctl00_m_g_6fa5b9c4_c769_4474_b0c7_86f47a03c391_ctl00_ctl01_ctl00_toolBarTbl td:eq(8)').hide();
}
if(isPage('newServiceRequest')||isPage('servicerequests/newForm.aspx')||isPage('archive/newForm.aspx')){
assignRowAttributes();
// hide the reassign flag since we are going to control it automatically
$('.reassign_request').hide();
$('.reassign_flag').hide();
$('.case_id').hide();
$('.2nd_level_support_returned').hide();
newServiceRequestInit();
}
Here are the functions called when the condition for newForm is met above:
/******************************************************/
/* FIELD MANIPULATION /
/*****************************************************/
function assignRowAttributes(){
$('.ms-formlabel').parent().each(function(){
var label=$(this).find('h3 nobr').text();
if(label==''){
$(this).attr('title',label);
}
else{
$(this).attr('rel',label);
}
$(this).addClass(createFieldID(label));
});
}
function createFieldID(title){
var newString = title.replace(/[^a-zA-Z 0-9]+/g,'');
newString=$.trim(newString);
newString=newString.replaceAll(' ','_');
newString=newString.toLowerCase();
return newString;
}
function newServiceRequestInit(){
$().SPServices.SPCascadeDropdowns({
relationshipWebURL: "",
relationshipList: "Resolution codes",
relationshipListParentColumn: "Reason_x0020_Code",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "",
parentColumn: "Reason Code",
childColumn: "Resolution Code",
CAMLQuery: "",
listName: $().SPServices.SPListNameFromUrl(),
promptText: "Choose {0}...",
simpleChild: false, // Added in v0.6.2
selectSingleOption: false, // Added in v0.6.2
matchOnId: false, // Added in v0.7.1 completefunc: null,
debug: true
});
$('input[title="Resolution Code"]').change(function(){
$(".error").hide();
var currentval=$(this).val();
if(currentval=="Other"){
alert('Please describe the resolution method in the Problem Description field');
}
});
$('.closed_flag input').click(function(){
if($(this).attr('checked')){
$('.resolution_code input').attr('required','required');
$('tr.resolution_code nobr').append('<span class="ms-formvalidation"> *</span>');
}
else{
$('.resolution_code input').removeAttr('required');
$('tr.resolution_code nobr span .ms-formvalidation').remove();
}
});
$('select[title=Status]').click(function(){
if($(this).val()=='Closed'){
$('input[title=Resolution Code],select[title=Resolution Code]').attr('required','required');
}
else{
$('input[title=Resolution Code],select[title=Resolution Code]').removeAttr('required');
}
});
}
function isPage(URL){
if(window.location.href.toLowerCase().indexOf(URL.toLowerCase())!=-1){ return true; }
else{ return false; }
}