Snippets

Jonathan Hult WebCenter Content - Checkin - conditionally require field

Created by Jonathan Hult
<$custom_pre_complete_checkin_script = '
	<$include super.custom_pre_complete_checkin_script$>
	
	var checkinForm = document.getElementsByName("Checkin")[0];
	var field1 = checkinForm.dDocName;
	var field2 = checkinForm.xComments;
	if (field1 != null && (field1.value == null || field1.value.length == 0) && field2 != null && (field2.value == null || field2.value.length == 0)) {
		alert("Field 1 or Field 2 is required");
		return;
	}
'$>
<$setResourceInclude('custom_pre_complete_checkin_script', custom_pre_complete_checkin_script)$>

Comments (3)

  1. loveneet s

    Thank you for your script. It really helped me a lot and now it works!! Thanks for your great script .. i have also visited your blog its very well written. Thanks my blog

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.