PageSourceSearch

https://www.amgeniss.com/-/media/Themes/CorporateAffairs/amgeniss-com/amgeniss-com/Scripts/clinical-form.js

js amgeniss.com collected 2026-10-05 08:50:20 UTC 16,133 bytes, 483 lines download raw bytes

1$(document).ready(function () {
2	$('#signupForm').validate({
3		errorPlacement: function (error, element) {
4			if (element.attr('name') == 'ind-auth' || element.attr('name') == 'study-phase' || element.attr('name') == 'treatment-line' || element.attr('name') == 'support' || element.attr('name') == 'acknowledge-datastore') {
5				error.insertBefore(element);
6				$('#acknowledge-datastore-error').appendTo('.acknowledge');
7			} else {
8				error.insertAfter(element);
9			}
10		}
11	});
12
13	$('#signupForm').on('keyup keypress', function (e) {
14		var keyCode = e.keyCode || e.which;
15		if (e.target.tagName != 'TEXTAREA') {
16			if (keyCode === 13) {
17				e.preventDefault();
18				return false;
19			}
20		}
21	});
22
23	//var sponsor = document.submission.name.value;
24	//Form Save And Submit 
25	$("#btnsave").click(function (e) {
26		e.preventDefault();
27		//$("#loadingDiv").show();
28		/*if($.trim($("#sponsor").val()) === "" || 
29			$.trim($("#principal-investigator").val()) === "" || 
30			$.trim($("#sp-mail-2").val()) === "" || 
31			$.trim($("#contract-administrator").val()) === "" || 
32			$.trim($("#amgen-contact").val()) === "" || 
33			$.trim($("#amgen-product").val()) === "" || 
34			$.trim(!$("input[name='sponsor_capability']").is(':checked')) || 
35			$.trim($("#added-file").val()) === "") {
36			//alert('Please fill all fields.');
37			$("label.error").show();
38			//$("#valErrorMsg2").show();
39			
40			return false;
41		}*/
42
43		/*if($("#sponsor").val() === null || $("#sponsor").val() === ""){
44			$("label.error").show();
45			document.getElementById("sponsor").focus();
46			$("html, body").animate({
47				scrollTop: $("#sponsor").offset().top - 80
48			}, 100);
49		}
50		else if($("#principal-investigator").val() === null || $("#principal-investigator").val() === ""){
51			$("label.error").show();
52			document.getElementById("principal-investigator").focus();
53			$("html, body").animate({
54				scrollTop: $("#principal-investigator").offset().top - 80
55			}, 100);
56		}
57		else if($("#sp-mail-2").val() === null || $("#sp-mail-2").val() === ""){
58			$("label.error").show();
59			document.getElementById("sp-mail-2").focus();
60			$("html, body").animate({
61				scrollTop: $("#sp-mail-2").offset().top - 80
62			}, 100);
63		}
64		else if($("#contract-administrator").val() === null || $("#contract-administrator").val() === ""){
65			$("label.error").show();
66			document.getElementById("contract-administrator").focus();
67			$("html, body").animate({
68				scrollTop: $("#contract-administrator").offset().top - 80
69			}, 100);
70		}
71		else if($("#amgen-contact").val() === null || $("#amgen-contact").val() === ""){
72			$("label.error").show();
73			document.getElementById("amgen-contact").focus();
74			$("html, body").animate({
75				scrollTop: $("#amgen-contact").offset().top - 80
76			}, 100);
77		}
78		else if($("#amgen-product").val() === null || $("#amgen-product").val() === ""){
79			$("label.error").show();
80			document.getElementById("amgen-product").focus();
81			$("html, body").animate({
82				scrollTop: $("#amgen-product").offset().top - 80
83			}, 100);
84		}
85		else if(!$("input[name='sponsor_capability']").is(':checked')){
86			$("label.error").show();
87			document.getElementById("sponsor-yes").focus();
88			$("html, body").animate({
89				scrollTop: $("#sponsor-yes").offset().top - 80
90			}, 100);
91		}
92		else if(($("#added-file").val() === null || $("#added-file").val() === "") && $(".filUploadWrap .fileControls").html() == "" ){
93			$("label.error").show();
94				document.getElementById("added-file").focus();
95				$("html, body").animate({
96				scrollTop: $("#added-file").offset().top - 80
97			}, 100);
98		}
99	
100		// else if ($('#added-file').get(0).files.length === 0) {
101		// 	$("#added-file-error").show();
102		// }
103		else {
104		
105			//$('#signupForm').submit() */
106		var fd = new FormData();
107
108		var uploadedfiles = $("#added-file").get(0);
109		for (let i = 0; i < uploadedfiles.files.length; ++i) {
110			fd.append("submissionFile", uploadedfiles.files[i]);
111		}
112
113		//$("#Save-Modal").addClass("quantum-modal--visible");
114		//if($("#Save-Modal").hasClass("quantum-modal--visible")){
115		/*setTimeout(function(){
116			$("#Save-Modal").removeClass("quantum-modal--visible");
117			//location.reload();
118		}, 5000);*/
119		//}
120
121		$("#submitType").val("Save");
122		$("#userEmailaddress").val(getCookieValue('registerdUserEmail'));
123		var id = $("input[name='FormId']").val();
124		id = id.replace(/[^a-zA-Z0-9]/g, '');
125		$("#MediaFramework_ItemId").val(id);
126		$("#signupForm").find(":input[type='text'], textarea,input[type='hidden'],input[type='file'], input[type='number'], select").each(function () {
127			// The selector will match buttons; if you want to filter
128			// them out, check `this.tagName` and `this.type`; see
129			// below
130			fd.append(this.name, $(this).val());
131			//fileData[this.name] = $(this).val();
132		});
133		$("#signupForm").find(":input[type='radio'], input[type='checkbox']").each(function () {
134			if ($(this).is(":checked")) {
135				fd.append(this.name, $(this).val());
136				//	var val = $(this).val(); 
137			}
138
139		});
140
141		$("#sponsor-error").addClass('hide');
142		$("#contract-administrator-error").addClass('hide');
143		$("#principal-investigator-error").addClass('hide');
144		$("#sp-mail-2-error").addClass('hide');
145		$("#amgen-contact-error").addClass('hide');
146		$("label[name='sponsor_capability']").addClass('hide');
147		$("#amgen-product-error").addClass('hide');
148		$("#added-file-error").addClass('hide');
149		$('#sp_mail_2').removeAttr('required')
150
151
152		if ($(this).valid()) {
153			/*setTimeout(() => {
154				$("#loadingDiv").hide();
155			}, 200);*/
156
157			ajaxSave(fd);
158
159		}
160
161
162	});
163
164
165	$("#btntrigger").click(function (e) {
166		e.preventDefault();
167		var isClinicalFormValid = true;
168		//$('#signupForm').submit()
169	
170	    $("#sponsor-error").removeClass('hide');
171		$("#contract-administrator-error").removeClass('hide');
172		$("#principal-investigator-error").removeClass('hide');
173		$("#sp-mail-2-error").removeClass('hide');
174		$("#amgen-contact-error").removeClass('hide');
175		$("label[name='sponsor_capability']").removeClass('hide');
176		$("#amgen-product-error").removeClass('hide');
177		$("#added-file-error").removeClass('hide');
178	
179		var _count = 0;
180		$('input[type="text"]._required, select._required').each(function () {
181			if ($(this).prop('required')) {
182				if ($(this).val() == "" || $(this).val() == null || $(this).val() == undefined) {
183					_count++;
184					isClinicalFormValid = false;
185					$(this).siblings("label.error").show();
186				    $(this).parent().closest("label.error").show();
187					if (_count == 1) {
188						$(this).focus();
189						document.getElementById($(this).attr("id")).focus();
190					}
191					//return false;
192				}
193			}
194		});
195		$('input[type="radio"]._required').each(function () {
196			if ($(this).prop('required')) {
197				if (!$("input[name='sponsor_capability']").is(':checked')) {
198					_count++;
199					isClinicalFormValid = false;
200					$(this).siblings("label.error").show();
201				    $(this).parent().closest("label.error").show();
202					$("label[name='sponsor_capability']").show();
203					if (_count == 1) {
204						$(this).focus();
205						$("label[name='sponsor_capability']").show();
206						// isClinicalFormValid = false;
207						document.getElementById("sponsor-yes").focus();
208					}
209					//return false;
210				}
211			}
212		});
213		$('input[type="file"]._required').each(function () {
214			if ($(this).prop('required')) {
215				if ($("#added-file").get(0).files.length === 0 && $(".fileControls").children().length ==0 &&  $("#added_fileUpload").children().length ==0) {
216					_count++;
217					isClinicalFormValid = false;
218                    $("#added-file-error").html("Attachment(s) required"); 
219                    $(this).siblings("label.error").show();
220				    $(this).parent().find("label.error").show();
221					if (_count == 1) {
222						$(this).focus();
223						$("label#added-file-error").show();
224						// isClinicalFormValid = false;
225						//document.getElementById("sponsor-yes").focus();
226					}
227					//return false;
228				}
229			}
230		});
231		$("#added-file").change(function(){
232			if ($('#added-file').get(0).files.length > 0) {
233				$("label#added-file-error").hide();
234				$("#added-file-error").html("");
235			}
236		});
237
238		
239
240		/*if($("#sponsor").val() === null || $("#sponsor").val() === ""){
241			$("#sponsor-error").show();
242			isClinicalFormValid = false;
243			document.getElementById("sponsor").focus();
244			$("html, body").animate({
245				scrollTop: $("#sponsor").offset().top - 80
246			}, 100);
247		}
248		if($("#principal-investigator").val() === null || $("#principal-investigator").val() === ""){
249			$("#principal-investigator-error").show();
250			isClinicalFormValid = false;
251			document.getElementById("principal-investigator").focus();
252			$("html, body").animate({
253				scrollTop: $("#principal-investigator").offset().top - 80
254			}, 100);
255		}
256		if($("#sp-mail-2").val() === null || $("#sp-mail-2").val() === ""){
257			$("#sp-mail-2-error").show();
258			isClinicalFormValid = false;
259			document.getElementById("sp-mail-2").focus();
260			$("html, body").animate({
261				scrollTop: $("#sp-mail-2").offset().top - 80
262			}, 100);
263		}
264		if($("#contract-administrator").val() === null || $("#contract-administrator").val() === ""){
265			$("#contract-administrator-error").show();
266			isClinicalFormValid = false;
267			document.getElementById("contract-administrator").focus();
268			$("html, body").animate({
269				scrollTop: $("#contract-administrator").offset().top - 80
270			}, 100);
271		}
272		if($("#amgen-contact").val() === null || $("#amgen-contact").val() === ""){
273			$("#amgen-contact-error").show();
274			isClinicalFormValid = false;
275			document.getElementById("amgen-contact").focus();
276			$("html, body").animate({
277				scrollTop: $("#amgen-contact").offset().top - 80
278			}, 100);
279		}
280		if($("#inputStudyTitle").val() === null || $("#inputStudyTitle").val() === ""){
281			$("#inputStudyTitle-error").show();
282			isClinicalFormValid = false;
283			document.getElementById("inputStudyTitle").focus();
284			$("html, body").animate({
285				scrollTop: $("#inputStudyTitle").offset().top - 80
286			}, 100);
287		}
288		if($("#amgen-product").val() === null || $("#amgen-product").val() === ""){
289			$("#amgen-product-error").show();
290			isClinicalFormValid = false;
291			document.getElementById("amgen-product").focus();
292			$("html, body").animate({
293				scrollTop: $("#amgen-product").offset().top - 80
294			}, 100);
295		}
296		if($("#amgen-timeline").val() === null || $("#amgen-timeline").val() === ""){
297			$("#amgen-timeline-error").show();
298			isClinicalFormValid = false;
299			document.getElementById("amgen-timeline").focus();
300			$("html, body").animate({
301				scrollTop: $("#amgen-timeline").offset().top - 80
302			}, 100);
303		}
304		if(!$("input[name='sponsor_capability']").is(':checked')){
305			$("label[name='sponsor_capability']").show();
306			isClinicalFormValid = false;
307			document.getElementById("sponsor-yes").focus();
308			$("html, body").animate({
309				scrollTop: $("#sponsor-yes").offset().top - 80
310			}, 100);
311		}
312		if($("#added-file").val() === null || $("#added-file").val() === ""){
313			$("#added-file-error").show();
314			isClinicalFormValid = false;
315			document.getElementById("added-file").focus();
316			$("html, body").animate({
317				scrollTop: $("#added-file").offset().top - 80
318			}, 100);
319		}*/
320
321		if (isClinicalFormValid) {
322			if ($("#Submission-success").hasClass("quantum-modal--visible")) {
323				setTimeout(function () {
324					location.reload();
325				}, 2000);
326			}
327			var fd = new FormData();
328
329			var uploadedfiles = $("#added-file").get(0);
330			for (let i = 0; i < uploadedfiles.files.length; ++i) {
331				fd.append("submissionFile", uploadedfiles.files[i]);
332			}
333
334			$("#submitType").val("Submit");
335			$("#userEmailaddress").val(getCookieValue('registerdUserEmail'));
336			var id = $("input[name='FormId']").val();
337			id = id.replace(/[^a-zA-Z0-9]/g, '');
338			$("#MediaFramework_ItemId").val(id);
339			$("#signupForm").find(":input[type='text'], textarea,input[type='hidden'],input[type='file'], input[type='number'], select").each(function () {
340				// The selector will match buttons; if you want to filter
341				// them out, check `this.tagName` and `this.type`; see
342				// below
343				fd.append(this.name, $(this).val());
344				//fileData[this.name] = $(this).val();
345			});
346			$("#signupForm").find(":input[type='radio'], input[type='checkbox']").each(function () {
347				if ($(this).is(":checked")) {
348					fd.append(this.name, $(this).val());
349					//	var val = $(this).val(); 
350				}
351
352			});
353			if ($(this).valid()) {
354				ajax(fd);
355
356			}
357		}
358	});
359
360	$("#close.quantum-modal__close").click(function () {
361		setTimeout(function () {
362			location.reload();
363		}, 400);
364	})
365
366
367
368	$("#sponsor-yes").change(function () {
369		$("label.error[name='sponsor_capability']").hide();
370	});
371	$("#sponsor-no").change(function () {
372		$("label.error[name='sponsor_capability']").hide();
373	});
374	$("#sponsor_na").change(function () {
375		$("label.error[name='sponsor_capability']").hide();
376	});
377
378	$("#added-file").on("change, blur", function () {
379		if ($(this).val() > 0) {
380			$("#added-file-error").hide();
381			//document.getElementById("login-email-error").innerHTML = "Please enter a valid Email";  
382		}
383	});
384
385
386	function ajaxSave(fd) {
387	  $("#loadingDiv").show();
388		var headers = { __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val() };
389		$.ajax({
390			headers: headers,
391			url: '/api/sitecore/AmgenIss/InsertIssForm',
392			type: 'POST',
393			contentType: 'application/x-www-form-urlencoded; charset=UTF-',
394			contentType: false,
395			processData: false,
396			//data: { test: form, fdata: fileData },
397			data: fd,
398			success: function (data) {
399				if (data.Status == "Data Saved Successfully" || data.Status == "Email Sent Successfully") {
400					 $("#loadingDiv").hide();
401					
402					$("#Save-Modal").addClass("quantum-modal--visible");
403					setTimeout(function () {
404						$("#Save-Modal").removeClass("quantum-modal--visible");
405						//location.reload();
406					}, 5000);
407					//$('.success-message').show();
408
409				}
410				else {
411					 $("#loadingDiv").hide();
412					
413					$('#signupForm').hide();
414					$('.table-section').hide();
415					$('.submit-button').hide();
416					$('.subFormDescription').hide();
417					$('.failure-message').show();
418				}
419			},
420			error: function (xhr, error, status) {
421				console.log(error, status);
422				 $("#loadingDiv").hide();
423					
424					$('#signupForm').hide();
425					$('.table-section').hide();
426					$('.submit-button').hide();
427					$('.subFormDescription').hide();
428					$('.failure-message').show();
429			}
430		});
431	}
432
433
434	function ajax(fd) {
435	$("#loadingDiv").show();
436		var headers = { __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val() };
437		$.ajax({
438			headers: headers,
439			url: '/api/sitecore/AmgenIss/InsertIssForm',
440			type: 'POST',
441			contentType: 'application/x-www-form-urlencoded; charset=UTF-',
442			contentType: false,
443			processData: false,
444			//data: { test: form, fdata: fileData },
445			data: fd,
446			success: function (data) {
447				if (data.Status == "Data Saved Successfully" || data.Status == "Email Sent Successfully") {
448					 $("#loadingDiv").hide();
449					
450					$('#signupForm').hide();
451					$('.table-section').hide();
452					$('.submit-button').hide();
453					$('.subFormDescription').hide();
454					$('.success-message').show();
455					$("html, body").animate({
456											scrollTop: $(".bluebanner-container").offset().top - 80
457										}, 100);
458
459				}
460				else {
461					 $("#loadingDiv").hide();
462					
463					$('#signupForm').hide();
464					$('.table-section').hide();
465					$('.submit-button').hide();
466					$('.subFormDescription').hide();
467					$('.failure-message').show();
468				}
469			},
470			error: function (xhr, error, status) {
471				console.log(error, status);
472				 $("#loadingDiv").hide();
473					$('#signupForm').hide();
474					$('.table-section').hide();
475					$('.submit-button').hide();
476					$('.subFormDescription').hide();
477					$('.failure-message').show();
478			}
479		});
480	}
481
482});
483

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.