Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Jquery is not working after i enable the attachments in Share Point EditForm

$
0
0

Hi ,

I have customized the Edit form .After customization the attachment functionality is not working and resolved the issue by creating the new Edit form .The attachments section only works if i don't push any j query/java script functions.If i comment below line two lines the attachment sections works.But i would need to include them .Could you tell me how would i call below script in EditForm.

//_spBodyOnLoadFunctionNames.push("Test");

//_spBodyOnLoadFunctionNames.push("checkStatus");

<script>
function redirect(offerID)
{
  var loc = "DispForm.aspx?ID=" + offerID;
  window.location.href = loc;
}

function Test()    
{  

var TitleValue = "Drafting Communication";//$('#ctl00_m_g_1918401d_e6f3_4b9b_9262_dbb4aabcfd12_ff11_ctl00_ctl00_TextField').val();

alert(TitleValue );
if(TitleValue =="Drafting Communication")
{

$("select[Title='Workflow Stage']").find('option:contains("Stage 1 – Review")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 2 – Review")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 3 – Review")').remove();
 $("select[Title='Workflow Stage']").find('option:contains("Stage 4 – Review")').remove();


 }
 
 else if(TitleValue =="Stage-1 Pre Approval Business")
 {

 $("select[Title='Workflow Stage']").find('option:contains("Drafting Communication")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 2 – Review")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 3 – Review")').remove();
 $("select[Title='Workflow Stage']").find('option:contains("Stage 4 – Review")').remove();


}
else if(TitleValue =="Stage-2  Approval Marketing")
 {
$("select[Title='Workflow Stage']").find('option:contains("Drafting Communication")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 1 – Review")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 3 – Review")').remove();
 $("select[Title='Workflow Stage']").find('option:contains("Stage 4 – Review")').remove(); 

 
}
else if(TitleValue =="Stage-3  Approval Director")
 {


 $("select[Title='Workflow Stage']").find('option:contains("Drafting Communication")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 2 – Review")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 1 – Review")').remove();
 $("select[Title='Workflow Stage']").find('option:contains("Stage 4 – Review")').remove(); 
 }
 else
{
$("select[Title='Workflow Stage']").find('option:contains("Drafting Communication")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 2 – Review")').remove(); 
 $("select[Title='Workflow Stage']").find('option:contains("Stage 1 – Review")').remove();
 $("select[Title='Workflow Stage']").find('option:contains("Stage 3 – Review")').remove(); 
 
  $(".SelectA").hide();
 
}


}

function getTagFromIdentifierAndTitle(tagName, title) 
{
  var tags = document.getElementsByTagName(tagName);
    for (var i=0; i < tags.length; i++) {
     var tempString = tags[i].id;
    if (tags[i].title== title) {
    alert(tags[i].title);
      return tags[i].value;
    }
  }
  return null;
}

function checkStatus() {
  var selectedId = getField('select','Current Status').options[getField('select','Current Status').selectedIndex].value;
   var docID = 73;
   
  if(selectedId == 'Approved')
   $("input[value$='Save']").attr('disabled', true); 
 
 }

function getField(fieldType,fieldTitle) {   
    var docTags = document.getElementsByTagName(fieldType);   
    for (var i=0; i < docTags.length; i++) {   
        if (docTags[i].title == fieldTitle) {   
            return docTags[i]   
        }   
    }  
}

//_spBodyOnLoadFunctionNames.push("Test");

//_spBodyOnLoadFunctionNames.push("checkStatus");

</script>


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>