<script async src="/SiteAssets/SupportFiles/jquery-1.10.1.ui.min-.js"></script>
<script src="/SiteAssets/SupportFiles/jquery.SPServices-2014.02.min.js"></script>
<style>
.ui-helper-hidden-accessible {
display: none !important;
}
.ui-dialog {
width: auto !important;
}
.ui-widget-header, .ui-state-default, ui-button {
background: #b9cd6d;
border: 1px solid #b9cd6d;
color: #FFFFFF;
font-weight: bold;
}
.dropdownPadding {
padding-top: 25px;
}
</style>
<script type="text/ecmascript">
var coll = new Array();
// Onload
$(document).ready(function () {
var listName = "SLs and Factories";
$("#tags").autocomplete({
source: function (req, add) {
// var suggestions = search(req.term, listName);
var coll = new Array();
var seltdVal = req.term;
try {
debugger;
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<view><Query><Where><Contains><FieldRef Name="Factory" /><Value Type="Text">' + seltdVal + '</Value></Contains></Where></Query><RowLimit>10</RowLimit></view>');
collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(
function () {
debugger;
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
debugger;
var oListItem = listItemEnumerator.get_current();
var ttl = oListItem.get_item('Factory')
coll.push({ label: ttl, value: ttl })
}
add(coll);
}, function () { alert('failed to load ' + listName); });
}
catch (ex) { alert(ex.message); }
}
});
});
function search(Seltdvalue, listName) {
var coll = new Array();
try {
debugger;
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<view><Query><Where><Contains><FieldRef Name="Factory" /><Value Type="Text">' + Seltdvalue + '</Value></Contains></Where></Query><RowLimit>10</RowLimit></view>');
collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(
function () {
debugger;
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
debugger;
var oListItem = listItemEnumerator.get_current();
var ttl = oListItem.get_item('Title')
coll.push({ label: ttl, value: ttl })
}
return coll;
}, function () { alert('failed to load ' + listName); });
}
catch (ex) { alert(ex.message);}
return coll
}
</script>
<%--<script type="text/ecmascript">
// Settings
var url = "/_vti_bin/listdata.svc/Headcount1?$top=10";
var field = "UIN";
// Onload
$(document).ready(function () {
$("#tags").autocomplete({
source: function (req, add) {
var suggestions = search(req.term, url, field);
add(suggestions);
}
});
});
function search(value, listurl, field) {
var coll = new Array();
var url = listurl;
$.ajax({
cache: true,
type: "GET",
async: false,
dataType: "json",
url: url,
success: function (data) {
var results = data.d;
for (att in results) {
var object = results[att];
for (attt in object) {
if (attt == field) {
coll.push({ label: object[attt], value: object[attt] })
}
}
}
}
});
return coll
}
</script> --%>
<div class="demo" style="width: 200px;">
<div class="ui-widget">
<input id="tags">
</div>
</div>
<div id="error" class="ms-error"></div>
<script src="/SiteAssets/SupportFiles/jquery-1.4.1.min.js"></script>
<script src="/SiteAssets/SupportFiles/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript">
(function ($) {
// we can now rely on $ within the safety of our "bodyguard" function - SP 2010
// Constatnt
var d = new Date();
var crrYear = d.getFullYear() - 2000; // two digits
var strProspective = "Prospective"; var strSpeculative = "Speculative";
var crrListCount = 1; var crrUIN = "";
var uinRowFound = false; uinAlert = true;
var uinNotFund = 0; var IBRowFound = false;
// Fileds Name
var SLine_Tit_ddl = "Service Line Required Field"; var SLine_mp = "DMS_x0020_Supply_x0020_Unit";//1 Service_x0020_Line
var PName_Tit = "Person Name"; var PName_mp = "Full_x0020_Name"; // Name1 DisplayFld //2
var OUC_Tit = "OUC"; var OUC_mp = "_x004f_UC3";//3
var IBW_Tit_ddl = "Individual Base of Work Required Field"; var IBW_mp = "Work_x0020_Country";//4
var RolCD_Tit_ddl = "Role Code Required Field"; var RolCD_mp = "Master_x0020_Role_x0020_Code";//5
var RoleDetl_Tit = "Role Detail"; var RolDetl_mp = "Job_x0020_Role";//6
var SlFact_List_ServiceLine_mp = "Service_x0020_Line";
var Factory_tit_ddl = "Factory"; var Factory_mp = "DMS_x0020_Factory"//8
var ProjctType_Tit_ddl = "Project Type Required Field";
var SaleFID_Tit = "Salesforce ID";
var CostType_Tit = "Cost Type Required Field";
// List Names
var PorjectJAcode_exernalName = "Column12";
var ProjectJACd_Tit = "Project (JA) Code";
// Lists
var listSLnFactory = "SLs and Factories";
var totalHeadCountlits = 4;
var listName = "Headcount1";
listNameRateCard = "Rate Card";
var totalRateCardCountlits = 2;
$(document).ready(function () {
AutoFill_UIN();
ProjectType_onChange();
ProjectJACode_auto();
ServiceLine_onChange();
CostType_onChange();
Factory_onChange();
IndividualBaseWorkCountry_onChange();
HideFileds_unwatedFields();
});
function HideFileds_unwatedFields() {
try {
$('.ms-input').each(function (index) {
var input = $(this);
// All Q ACT - hide - unwanted
if (input.context.title.indexOf('-') >= 0 && input.context.title.indexOf('Q') >= 0 && input.context.title.indexOf('Act') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
// Note: Hide other than All Current year flds ---// Zero or greater contains value -- > Less than Zero no value
if (input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('-') >= 0 && input.context.title.indexOf('CPS') < 0 &&
(input.context.title.indexOf(crrYear) < 0 || input.context.title.indexOf(crrYear + 1) < 0)) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
});
SetForcasts_onCostType();
}
catch (ex) { alert(ex.message); }
}
function AutoFill_UIN() {
$('.ms-long').keyup(function () {
try {
if (input.context.title == "UIN")
ClearAutoFilled();
var input = $(this);
if (input.val().length >= 9 && input.context.title == "UIN") {
crrUIN = input.val(); crrListCount = 1; listName = "Headcount1"; uinRowFound = false; uinNotFund = 0; uinAlert = true;
UIN_Keyup_Autofill(listName, input.val());
}
if (input.context.title == ProjectJACd_Tit && input.val().length > 1 && input.val().toLowerCase().indexOf('ja') < 0) {
alert(ProjectJACd_Tit + ": Should starts with 'JA' ");
$("input[title='" + ProjectJACd_Tit + "']").val("");
}
var PJType = $("select[title='" + ProjctType_Tit_ddl + "'] option:selected").text();
if ((PJType == strProspective || PJType == strSpeculative) && input.val().length >= 3 && input.context.title == SaleFID_Tit) {
if (input.val().indexOf('OI-') < 0) {
$("input[title='" + SaleFID_Tit + "']").val("OI-xxxxxx")
alert('Since selected project type is :" ' + PJType + '". ' + SaleFID_Tit + ' sould start with: OI-');
}
}
}
catch (ex) { alert(ex.message); }
});
}
function IndividualBaseWorkCountry_onChange() { //-----------------'Rate Card' List not available
//$("select[title='" + IBW_Tit_ddl + "']").change(function (event) {
// listNameRateCard = "Rate Card"; crrListCount = 1; IBRowFound = false;
// var IBCountry = $("select[title='" + IBW_Tit_ddl + "'] option:selected").text();
// IndividualBaseWork_onChangeFillOUC(listName, IBCountry);
//});
}
function IndividualBaseWork_onChangeFillOUC(listName, IBCountry) {
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<view><Query><Where><Eq><FieldRef Name="' + IBW_mp + '" /><Value Type="Text">' + IBCountry + '</Value></Eq></Where></Query><RowLimit>10</RowLimit></view>');
collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(
function () {
// ---
try {
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
}
if (!IBRowFound) {
for (var i = 1; i < totalHeadCountlits; i++) {
i = crrListCount;
if (listName.indexOf(i) >= 0 && !IBRowFound && i + 1 <= totalHeadCountlits) {
crrListCount++;
listName = listName.replace(i, i + 1);
IndividualBaseWork_onChangeFillOUC(listName, IBCountry)
if (IBRowFound)
break;
}
}
}
}
catch (ex) { alert(ex.message); }
//---
},
function () { alert("no") });
}
function ProjectType_onChange() {
$("select[title='" + ProjctType_Tit_ddl + "']").change(function (event) {
var PJType = $("select[title='" + ProjctType_Tit_ddl + "'] option:selected").text();
if (PJType == strProspective || PJType == strSpeculative) {
EnableDisableForecasts();
var SfiDLenth = $("input[title='" + SaleFID_Tit + "']").val().length;
var SfIDContains = $("input[title='" + SaleFID_Tit + "']").val().indexOf('OI-');
if ((SfiDLenth > 0 && SfIDContains < 0)) {
$("input[title='" + SaleFID_Tit + "']").val("OI-xxxxxx")
alert('Since selected project type is :" ' + PJType + '". ' + SaleFID_Tit + ' sould start with: OI-');
}
}
else {
// ProjectTypeNonPerNonSpecSelect(); -- In Progress
}
});
}
function ProjectJACode_auto() {
try {
$().SPServices.SPAutocomplete({
sourceList: "GS JA code Run Project Validation", // Source List Name
sourceColumn: "Title", // Source List Column from where you want to fetch it.
columnName: "Project (JA) Code", // Destination List Column where you wan to add it (Title - F12).
ignoreCase: true,
numChars: 2,
slideDownSpeed: 'fast'
});
}
catch (ex) { alert('Error 1 -' + ex.message); }
}
function ServiceLine_onChange() {
$("select[title='" + SLine_Tit_ddl + "']").change(function (event) {
try {
var sLine = $("select[title='" + SLine_Tit_ddl + "'] option:selected").text();
SetFacroryDDdata(listSLnFactory, sLine);
}
catch (ex) {
alert('Error SL -' + ex.message);
}
});
}
function CostType_onChange() {
$("select[title='" + CostType_Tit + "']").change(function (event) {
// EnableDisableForecasts();
SetForcasts_onCostType();
});
}
function SetForcasts_onCostType() {
var vType = $("select[title='" + CostType_Tit + "'] option:selected").text();
// Show Specific
if (vType.indexOf("IWA") >= 0) {
$('.ms-input').each(function (index) {
var input = $(this);
// Hide Euoro (None FTE)
debugger;
if (input.context.title.indexOf('-') >= 0 && input.context.title.indexOf('FTE') < 0 &&
input.context.title.indexOf(crrYear) >= 0 && input.context.title.indexOf('CPS') < 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
// Show FTES
if (input.context.title.indexOf('-') >= 0 && input.context.title.indexOf('FTE') >= 0 &&
input.context.title.indexOf(crrYear) >= 0 && input.context.title.indexOf('CPS') < 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').show();
}
});
}
else if (vType.indexOf("cost") >= 0) {
$('.ms-input').each(function (index) {
var input = $(this);
// Hide FTEs
debugger;
if (input.context.title.indexOf('-') >= 0 && input.context.title.indexOf('FTE') >= 0 &&
input.context.title.indexOf(crrYear) >= 0 && input.context.title.indexOf('CPS') < 0) { //
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
// Show Euros
if (input.context.title.indexOf('-') >= 0 && input.context.title.indexOf('FTE') < 0 &&
input.context.title.indexOf(crrYear) >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').show();
}
});
}
}
function Factory_onChange() {
$("select[title='" + Factory_tit_ddl + "']").change(function (event) {
var factVal = $("select[title='" + Factory_tit_ddl + "'] option:selected").text();
Factory_OnChange(listSLnFactory, factVal);
});
}
function ProjectTypeNonPerNonSpecSelect() {
debugger;
try {
$('.ms-input').each(function (index) {
var input = $(this);
if (ConstType.indexOf("IWA") >= 0) {
if (input.context.title.indexOf(crrYear + 1) >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').show();
}
}
else { // WP Fileds Cost type Default
if (input.context.title.indexOf(crrYear + 1) >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') <= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').show();
}
}
});
}
catch (ex) { alert(ex.message); }
}
function setConstTypeIWA() {
try {
$('.ms-input').each(function (index) {
var input = $(this);
if (input.context.title.indexOf('21-22') >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide(); //show -290321
}
// Hide Other
if (input.context.title.indexOf('19-20') >= 0 && input.context.title.indexOf('FTE') >= 0) { // FTE
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
if (input.context.title.indexOf('20-21') >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
//-------------------------------------------------------------------------------------
if (input.context.title.indexOf('19-20') >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') != 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
if (input.context.title.indexOf('20-21') >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') != 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
if (input.context.title.indexOf('21-22') >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') != 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
});
}
catch (ex) {
alert(ex.message);
}
}
function setCostTypeWP() {
try {
$('.ms-input').each(function (index) {
var input = $(this);
if (input.context.title.indexOf('21-22') >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') < 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide(); //show -290321
}
//Hide Others not needed
if (input.context.title.indexOf('19-20') >= 0 && input.context.title.indexOf('FTE') >= 0) { // FTE
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
if (input.context.title.indexOf('20-21') >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
if (input.context.title.indexOf('21-22') >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
//----------------------------------------------------------------------------------------------------
if (input.context.title.indexOf('19-20') >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
if (input.context.title.indexOf('20-21') >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
});
}
catch (ex) {
alert(ex.message);
}
}
function EnableDisableForecasts() {
var crrMonth = 0;
try {
var ConstType = $("select[title='" + CostType_Tit + "'] option:selected").text();
var PJType = $("select[title='" + ProjctType_Tit_ddl + "'] option:selected").text();
if (PJType == strProspective || PJType == strSpeculative) {
var crrMonth; // var crrMonth = d.getMonth() + 1 + 2; --> 2 is case for current plus 1 month
var forcastVal = getForecast_Pval(d.getMonth() + 1);
if (forcastVal === 11) {
crrMonth = 1; // 2 is case for current plus 1 month
crrYear++;
}
else if (forcastVal === 12) {
crrMonth = 2; // 2 is case for current plus 1 month
crrYear++;
}
else {
crrMonth = forcastVal + 2; // 2 is case for current plus 1 month
}
var crrYrrange = crrYear - 1 + '-' + crrYear;
var reqPforcast = "P" + crrMonth;
$('.ms-input').each(function (index) {
var input = $(this);
// Hide All Previous past 2 months
if (input.context.title.indexOf('-') >= 0 && input.context.title.indexOf('P') >= 0 && input.context.title.indexOf('FTE') != 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
if (input.context.title.indexOf("-") >= 0 && (input.context.title.indexOf("P1") >= 0 || input.context.title.indexOf('P2') >= 0 ||
input.context.title.indexOf('P2') >= 0 || input.context.title.indexOf('P3') >= 0 || input.context.title.indexOf('P4') >= 0 ||
input.context.title.indexOf('P5') >= 0 || input.context.title.indexOf('P6') >= 0 || input.context.title.indexOf('P7') >= 0 ||
input.context.title.indexOf('P8') >= 0 || input.context.title.indexOf('P9') >= 0 || input.context.title.indexOf('P10') >= 0 ||
input.context.title.indexOf('P11') >= 0 || input.context.title.indexOf('P12') >= 0)) {
$('nobr:contains("' + input.context.title + '")').closest('tr').hide();
}
// Show Specific
if (ConstType.indexOf("IWA") >= 0) {
if (input.context.title.indexOf(crrYrrange) >= 0 && input.context.title.indexOf(reqPforcast) >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').show(); //show
}
}
else if (ConstType.indexOf("cost") >= 0) {
if (input.context.title.indexOf(crrYrrange) >= 0 && input.context.title.indexOf(reqPforcast) >= 0 && input.context.title.indexOf('FTE') < 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').show();
}
}
});
}
}
catch (ex) {
alert(ex.message);
}
}
function EnableDisableForecasts_X() {
var crrMonth = 0;
try {
var crrMonth; // var crrMonth = d.getMonth() + 1 + 2; // 2 is case for current plus 1 month
var forcastVal = getForecast_Pval(d.getMonth() + 1);
if (forcastVal === 11) {
crrMonth = 1; // 2 is case for current plus 1 month
crrYear++;
}
else if (forcastVal === 12) {
crrMonth = 2; // 2 is case for current plus 1 month
crrYear++;
}
else {
crrMonth = forcastVal + 2; // 2 is case for current plus 1 month
}
var crrYrrange = crrYear - 1 + '-' + crrYear;
var reqPforcast = "P" + crrMonth;
var ConstType = $("select[title='" + CostType_Tit + "'] option:selected").text();
if (ConstType.indexOf("IWA") >= 0) {
setConstTypeIWA();
$('.ms-input').each(function (index) {
var input = $(this);
if (input.context.title.indexOf(crrYrrange) >= 0 && input.context.title.indexOf(reqPforcast) >= 0 && input.context.title.indexOf('FTE') >= 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').show(); //show
}
});
}
else if (ConstType.indexOf("cost") >= 0) {
setCostTypeWP();
$('.ms-input').each(function (index) {
var input = $(this);
if (input.context.title.indexOf(crrYrrange) >= 0 && input.context.title.indexOf(reqPforcast) >= 0 && input.context.title.indexOf('FTE') < 0) {
$('nobr:contains("' + input.context.title + '")').closest('tr').show();
}
});
}
}
catch (ex) {
alert(ex.message);
}
}
function getForecast_Pval(month) {
var Pval;
switch (month) {
case 4: Pval = 1; break;
case 5: Pval = 2; break;
case 6: Pval = 3; break;
case 7: Pval = 4; break;
case 8: Pval = 5; break;
case 9: Pval = 6; break;
case 10: Pval = 7; break;
case 11: Pval = 8; break;
case 12: Pval = 9; break;
case 1: Pval = 10; break;
case 2: Pval = 11; break;
case 3: Pval = 12; break;
default: Pval = 0;
}
return Pval;
}
function Factory_OnChange(listName, slSctd) {
try {
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<view><Query><Where><Contains><FieldRef Name="Factory" /><Value Type="Text">' + slSctd + '</Value></Contains></Where></Query><RowLimit>10</RowLimit></view>');
collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
var isSetFrst = true;
clientContext.executeQueryAsync(
function () {
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
$("input[title='" + OUC_Tit + "']").val(oListItem.get_item('Title'));
}
}, function () { alert('failed to load ' + listName); });
}
catch (ex) {
alert(ex.message);
}
}
function SetFacroryDDdata(listName, slSctd) {
try {
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<view><Query><Where><Eq><FieldRef Name="' + SlFact_List_ServiceLine_mp + '" /><Value Type="Choice">' + slSctd + '</Value></Eq></Where></Query><RowLimit>10</RowLimit></view>');
collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
var isSetFrst = true;
clientContext.executeQueryAsync(
function () {
$("select[title='" + Factory_tit_ddl + "']").empty();
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
if (isSetFrst) {
$("input[title='" + OUC_Tit + "']").val(oListItem.get_item('Title'))
isSetFrst = false;
}
var fval = oListItem.get_item("Factory");
$("select[title='" + Factory_tit_ddl + "']").append($("<option></option>").val(fval).html(fval));
}
}, function () { alert('failed to load ' + listName); });
}
catch (ex) {
alert(ex.message);
}
}
function UIN_Keyup_Autofill(listName, UIN) {
try {
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<view><Query><Where><Eq><FieldRef Name="UIN" /><Value Type="Number">' + UIN + '</Value></Eq></Where></Query><RowLimit>10</RowLimit></view>');
collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
//clientContext.executeQueryAsync(Function.createDelegate(this, OnLoadSuccess), //Function.createDelegate(this, OnLoadFailed));
clientContext.executeQueryAsync(
function () {
fillValues(collListItem);
if (uinNotFund > 1 && uinAlert) {
uinAlert = false;
alert('UIN : ' + crrUIN + ' - Not found in master list(s)');
}
},
function () {
alert("no")
}
);
}
catch (ex) {
alert(ex.message);
}
}
function fillValues(collListItem) {
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
uinRowFound = true;
var oListItem = listItemEnumerator.get_current();
$("input[title='" + PName_Tit + "']").val(oListItem.get_item(PName_mp));//2
$("input[title='" + OUC_Tit + "']").val(oListItem.get_item(OUC_mp));//3
$('select[title="' + IBW_Tit_ddl + '"] option:contains("' + oListItem.get_item(IBW_mp) + '")').attr({ selected: true });//4
$('select[title="' + RolCD_Tit_ddl + '"] option:contains("' + oListItem.get_item(RolCD_mp) + '")').attr({ selected: true });//5
$("input[title='" + RoleDetl_Tit + "']").val(oListItem.get_item(RolDetl_mp));//6
$('select[title="' + SLine_Tit_ddl + '"] option:contains("' + oListItem.get_item(SLine_mp) + '")').attr({ selected: true });//7
$('select[title="' + Factory_tit_ddl + '"] option:contains("' + oListItem.get_item(Factory_mp) + '")').attr({ selected: true });//8
break;
}
if (!uinRowFound) {
for (var i = 1; i < totalHeadCountlits; i++) {
i = crrListCount;
if (listName.indexOf(i) >= 0 && !uinRowFound && i + 1 <= totalHeadCountlits) {
crrListCount++;
listName = listName.replace(i, i + 1);
UIN_Keyup_Autofill(listName, crrUIN);
if (uinRowFound)
break;
}
}
}
if (!uinRowFound) {
uinNotFund++
}
}
function ClearAutoFilled() {
try {
$("input[title='" + PName_Tit + "']").val("");//2
$("input[title='" + OUC_Tit + "']").val("");//3
$("input[title='" + RoleDetl_Tit + "']").val("");//6
$('select[title="' + SLine_Tit_ddl + '"]').find('option:first').attr('selected', 'selected');//1
$('select[title="' + IBW_Tit_ddl + '"]').find('option:first').attr('selected', 'selected');//4
$('select[title="' + RolCD_Tit_ddl + '"]').find('option:first').attr('selected', 'selected');//5
$('select[title="' + Factory_tit_ddl + '"]').find('option:first').attr('selected', 'selected');//8
}
catch (ex) {
// alert(ex.message);
}
}
})(jQuery);
</script>
----------------------------------------------------------------------------------------------------------------------