public final void onFormSubmitted()

in wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java [770:863]


	public final void onFormSubmitted(IFormSubmitter submitter)
	{
		// check methods match
		if (getRequest().getContainerRequest() instanceof HttpServletRequest)
		{
			String desiredMethod = getMethod();
			String actualMethod = ((HttpServletRequest)getRequest().getContainerRequest()).getMethod();
			if (!actualMethod.equalsIgnoreCase(desiredMethod))
			{
				MethodMismatchResponse response = onMethodMismatch();
				switch (response)
				{
					case ABORT :
						return;
					case CONTINUE :
						break;
					default :
						throw new IllegalStateException("Invalid " +
								MethodMismatchResponse.class.getName() + " value: " + response);
				}
			}
		}

		markFormsSubmitted(submitter);

		if (handleMultiPart())
		{
			// Tells FormComponents that a new user input has come
			inputChanged();

			// First, see if the processing was triggered by a IFormSubmittingComponent
			if (submitter == null)
			{
				submitter = findSubmitter();

				if (submitter instanceof IFormSubmittingComponent)
				{
					IFormSubmittingComponent submittingComponent = (IFormSubmittingComponent)submitter;
					Component component = (Component)submitter;

					if (!component.isVisibleInHierarchy())
					{
						throw new WicketRuntimeException("Submit Button " +
							submittingComponent.getInputName() + " (path=" +
							component.getPageRelativePath() + ") is not visible");
					}

					if (!component.isEnabledInHierarchy())
					{
						throw new WicketRuntimeException("Submit Button " +
							submittingComponent.getInputName() + " (path=" +
							component.getPageRelativePath() + ") is not enabled");
					}
				}
			}

			// When processing was triggered by a Wicket IFormSubmittingComponent and that
			// component indicates it wants to be called immediately
			// (without processing), call the IFormSubmittingComponent.onSubmit* methods right
			// away.
			if (submitter != null && !submitter.getDefaultFormProcessing())
			{
				submitter.onSubmit();
				submitter.onAfterSubmit();
			}
			else
			{
				// the submit request might be for one of the nested forms, so let's
				// find the right one:
				final Form<?> formToProcess = findFormToProcess(submitter);

				// process the form for this request
				formToProcess.process(submitter);
			}
		}
		// If multi part did fail check if an error is registered and call
		// onError
		else if (hasError())
		{
			callOnError(submitter);
		}

		// update auto labels if we are inside an ajax request
		getRequestCycle().find(AjaxRequestTarget.class).ifPresent(target -> {
			visitChildren(FormComponent.class, new IVisitor<FormComponent<?>, Void>()
			{
				@Override
				public void component(FormComponent<?> component, IVisit<Void> visit)
				{
					component.updateAutoLabels(target, false);
				}
			});
		});
	}