Add and remove required validation of HTML form fields in the OA process form of PWC 3

/**

  • Add required verification to the field.
    */
var addInputCheckField = function(fieldId, spanImgId) {
    
    
	$('#' + fieldId).attr('viewtype', '1');
	var fieldStr = $('input[name=needcheck]').val();
	if (fieldStr.charAt(fieldStr.length - 1) != ',') {
    
    
		fieldStr += ',';
	}
	$('input[name=needcheck]').val(fieldStr + fieldId + ',');
	$('#' + spanImgId).html('<img src="/images/BacoError_wev8.gif" align="absMiddle">');
};

/**

  • The removed field is required for verification.
    */
var removeInputCheckField = function(fieldId, spanImgId) {
    
    
	$('#' + fieldId).attr('viewtype', '0');
	var fieldStr = $('input[name=needcheck]').val();
	$('input[name=needcheck]').val(fieldStr.replace(fieldId + ',', ''));
	$('#' + spanImgId).html('');
};

// Call to remove required verification function

removeInputCheckField('field10391', 'field10391span');	// 移除必填验证,主表文本框、选择框
removeInputCheckField('field10849', 'field10849spanimg');	// 移除必填验证,主表浏览框
removeInputCheckField('field10859_0', 'field10859_0span');	// 移除必填验证,明细表文本框、选择框
removeInputCheckField('field10859_0', 'field10859_0spanimg');	// 移除必填验证,明细表浏览框

// Call to add required verification function

addInputCheckField('field10391', 'field10391span');	// 添加必填验证,主表文本框、选择框
addInputCheckField('field10849', 'field10849spanimg');	// 添加必填验证,主表浏览框
addInputCheckField('field10859_0', 'field10859_0span');	// 添加必填验证,明细表文本框、选择框
addInputCheckField('field10859_0', 'field10859_0spanimg');	// 添加必填验证,明细表浏览框

Please leave a message in the comment area and discuss together~~~

If necessary, please contact WeChat: hdygzh2019 At the same time, please explain your intention and make progress together! ! !

Guess you like

Origin blog.csdn.net/Y_6155/article/details/109018908