public void formEntrySaved(FormDef form, FormInstance instanceData, boolean formWasCompleted) {
		System.out.println("form is complete: " + formWasCompleted);
 
		//Warning, this might be null
		final SubmissionProfile profile = form.getSubmissionProfile();
		
		if (formWasCompleted) {
			
			// We want to cache this send before we actually ask, otherwise the user could quit before it is
			// either sent _or_ saved.
			
			IStorageUtility storage = StorageManager.getStorage(FormInstance.STORAGE_KEY);
			try {
				Logger.log("formentry","writing data: " + instanceData.getName());
				storage.write(instanceData);
				final int record = instanceData.getID();

				TransportMessage message = JRDemoContext._().buildMessage(instanceData, profile);
				
				CompletedFormOptionsState completed = new CompletedFormOptionsState(message) {
	
					public void sendData(TransportMessage message) {
						
						JRDemoFormTransportState send = new JRDemoFormTransportState(message, record) {
							public void done() {
								JRDemoUtil.goToList(cameFromFormList);
							}
		
							public void sendToBackground() {
								JRDemoUtil.goToList(cameFromFormList);
							}
						};
							
						send.start();
					}
	
					public void skipSend(TransportMessage message) {
						// Message should already be cached.
						abort();
					}
				};
				completed.start();
			} catch (StorageFullException e) {
				new RuntimeException("Storage full, unable to save data.");
			}
		} else {
			abort();
		}
	}
	public static void exception (String info, Exception e) {
		e.printStackTrace();
		log("exception", (info != null ? info + ": " : "") + WrappedException.printException(e));
	}