 				var hasPermitType=false;
 				var hasIssuedTo=false;
 				var hasIssuedBy=false;
+				var theProbs=[];
 
 				console.log('clicky');
 				$("select[id^='permit_type_']").each(function(e){



				$("input[id^='permit_agent_id_']").each(function(e){
					console.log('next=e');

					console.log($(this));
					console.log(e);
					console.log('next=val');

					console.log($(this).val());

					console.log('id:' + this.id);





				if (hasPermitType==false){
					theProb.push('Provide at least one permit type.');
				}
				if (hasIssuedTo==false){
					theProb.push('Provide at least one agent in role `issued to`.');
				}
				if (hasIssuedBy==false){
					theProb.push('Provide at least one agent in role `issued by`.');
				}


				if (theProb.lenght > 0){
					alert(theProb.join("\n"));
					return false;
				}

				alert('Text-field is empty.');
	        	return false;


