mirror of
				https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
				synced 2025-10-30 19:46:49 +00:00 
			
		
		
		
	| @@ -22,20 +22,20 @@ function initFormHandler() { | ||||
| 	*/ | ||||
| 	let select = document.getElementById("select"); | ||||
| 	select.addEventListener("change", function() { | ||||
| 		const input = document.getElementById('source'); | ||||
| 		const input = document.getElementById("source"); | ||||
| 	 | ||||
| 		if (select.value == "file") { | ||||
| 			input.innerHTML = ` | ||||
| 			Source: | ||||
| 			<input type="file" accept="image/*" id="mealImg" name="mealImg"> | ||||
| 		  ` | ||||
| 			`; | ||||
| 		} | ||||
| 		//TODO: change to photo taking for sprint 3 | ||||
| 		else { | ||||
| 			input.innerHTML = ` | ||||
| 			Source: | ||||
| 			<input type="text" id="mealImg" name="mealImg"> | ||||
| 		  ` | ||||
| 			`; | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| @@ -51,7 +51,7 @@ function initFormHandler() { | ||||
| 		 | ||||
| 		//convert image file into data URL for local storage | ||||
| 		reader.readAsDataURL(document.getElementById("mealImg").files[0]); | ||||
| 	}) | ||||
| 	}); | ||||
| 		 | ||||
| 	form.addEventListener("submit", function(e){ | ||||
| 	/* | ||||
|   | ||||
| @@ -62,20 +62,20 @@ function setupUpdate(){ | ||||
| 		*/ | ||||
| 		let select = document.getElementById("select"); | ||||
| 		select.addEventListener("change", function() { | ||||
| 			const input = document.getElementById('source'); | ||||
| 			const input = document.getElementById("source"); | ||||
| 		 | ||||
| 			if (select.value == "file") { | ||||
| 				input.innerHTML = ` | ||||
| 				Source: | ||||
| 				<input type="file" accept="image/*" id="mealImg" name="mealImg"> | ||||
| 			` | ||||
| 				`; | ||||
| 			} | ||||
| 			//TODO: change to photo taking for sprint 3 | ||||
| 			else { | ||||
| 				input.innerHTML = ` | ||||
| 				Source: | ||||
| 				<input type="text" id="mealImg" name="mealImg"> | ||||
| 			` | ||||
| 				`; | ||||
| 			} | ||||
| 		}); | ||||
|  | ||||
| @@ -92,7 +92,7 @@ function setupUpdate(){ | ||||
| 			 | ||||
| 			//convert image file into data URL for local storage | ||||
| 			reader.readAsDataURL(document.getElementById("mealImg").files[0]); | ||||
| 		}) | ||||
| 		}); | ||||
|  | ||||
| 		 | ||||
| 		//Take formdata values as newData when submit | ||||
|   | ||||
		Reference in New Issue
	
	Block a user