Jump to content

iCombining scripts together


Recommended Posts

Hello everyone.

I have the following scripts in a details page footer :

function Displayer(n)

{

var check=document.getElementById('Section'+n);

if(check.style.display=='none')

{

check.style.display='inline';

}

else

{

check.style.display='none';

}

}

function assignauditcodes()

{

var position1 = document.getElementsByName("EditRecordGSP_Code")[0].value;

var position2 = document.getElementsByName("EditRecordAuditing_Location")[0].value;

var allpositions = position1+"-"+position2;

var position3 = document.getElementsByName("EditRecordGSP_Code")[0].value;

var position4 = document.getElementsByName("EditRecordAppointed_AE_Code3")[0].value;

var position5 = document.getElementsByName("EditRecordAuditing_Location")[0].value;

var position6 = document.getElementById("EditRecordAudit_Category").value;

var position7 = document.getElementsByName("EditRecordAudit_Schedule")[0].value;

var position8 = position7.substr(6,4) ;

var allpositions2 = "ISAGO"+"-"+position3+"-"+position4+"-"+position5+"-"+position6+"-"+position8;

document.getElementById("EditRecordAudit_Code").value = allpositions;

document.getElementById("EditRecordAudit_Allocation_Code").value = allpositions2;

}

document.getElementById("caspioform").onsubmit=assignauditcodes;

var setCurrentStatus = function(status) {

document.getElementsByName('EditRecordAudit_Current_Status')[0].value = status;

}

document.getElementById('caspioform').onsubmit = function() {

var appointedAE = document.getElementsByName('EditRecordAppointed_AE_Code')[0].value;

var closeDate = document.getElementById('EditRecordAudit_Closing_Date').value;

var today = new Date();

today.setHours(0,0,0,0);

if(appointedAE == '-None-') {

setCurrentStatus('1-New');

} else if(closeDate == '') {

setCurrentStatus('2-Assigned');

} else {

closeDate = new Date(closeDate);

closeDate.setHours(0,0,0,0);

if(closeDate > today) {

setCurrentStatus('3-Scheduled');

} else {

setCurrentStatus('4-Performed');

}

}

}

When updating the record the assignauditcodes() function doesn't seem to work.

However, if i remove completely the last script (var current status ….) it works perfectly. I assume that there is something wrong, when both these scripts appear together.

Could anyone advise what might be wrong ?

Thank you very much

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...