Onsubmit vs onchange function
Posted: 06 Jul 2018
Hi there,
I have a function which works perfectly fine onsubmit:
I need it to work on change though .... so i tried this:
and the subsring is not passed to the field.... Could you please help me and point out my mistake?
I have a function which works perfectly fine onsubmit:
Code: Select all
fd.onsubmit(function() {
var container = fd.field('Facility').control()._el().find('.ms-taxonomy').get(0);
var taxCtlObj = new Microsoft.SharePoint.Taxonomy.ControlObject(container);
var termValue = taxCtlObj.getRawText();
var str = termValue;
var res = str.substr(0,4)
fd.field('FacilityCheck').value(res);
return true
});
Code: Select all
function setFC() {
var container = fd.field('Facility').control()._el().find('.ms-taxonomy').get(0);
var taxCtlObj = new Microsoft.SharePoint.Taxonomy.ControlObject(container);
var termValue = taxCtlObj.getRawText();
var str = termValue;
var res = str.substr(0,4)
fd.field('FacilityCheck').value(res);
}
// Calling when the user changes plant .
fd.field('Facility').change(setFC);
// Calling on form loading
setFC();