Cornerstone Form is not submitted when certain fields are shown based on conditions

Hello,
I have been using Cornerstone Forms and I recently encountered an error, with a form that has a redirect on completion
It has fields (required) that appear based on conditions. The form is not submitted and I cannot understand the error, as nothing appears on the screen (e.g. I get an error if a required field is missing, but no specific error if everything is OK and the form just won’t submit).

A similar (development) form is submitted perfectly (but has fewer conditions, and is set to submit via AJAX).

I tried changing cache settings, disabling plugins etc.

Could you please take a look?

Hey @agelada,

The given credentials are not working. While we wait for the correct credentials, please check the suggestions below.

1. Why nothing appears on screen (The “Invisible” Validation Error)

In Cornerstone Forms, errors can be configured to display inline (Error Inline toggle):

  • How it works: When inline errors are active, Cornerstone Forms detects which input failed and attaches the error message directly next to that specific DOM field instead of rendering it in the main/global error container.
  • The hidden field conflict: If a required field is hidden by conditional logic, but the backend validation determines that the field’s conditions were not met (or fails to evaluate them properly on standard POST), the server flags that field as a missing required field.
  • The silent failure: Because inline errors are enabled, the script injects the error message next to the field inside the DOM. But because that field is hidden by conditions, the error is also hidden.
  • This is why you see errors when a visible required field is empty, but see “nothing on screen” when all visible fields are filled in.

2. Standard POST Submission vs. AJAX Submission with Redirects

Your development form works because it is set to AJAX, while your production form is likely submitting as a standard POST request:

  • In AJAX mode (Dev Form):
    Cornerstone submits the form in the background using JavaScript fetch(). When the server executes the Redirect Action, fetch() follows the redirect in the background, retrieves the new page HTML, and seamlessly updates the page.
  • In Non-AJAX mode (Standard POST):
    The form submits natively. Cornerstone processes the form and calls WordPress’s wp_redirect() followed by exit;:
    1. Headers Already Sent: In WordPress, calling wp_redirect() during the page render phase often fails if headers or template content have already started outputting. If headers were already sent, wp_redirect() fails silently, and exit; terminates the PHP execution immediately (leaving a blank page or halting the request).
    2. Redirecting to Self: If the Redirect Action’s location is blank, malformed, or points back to the current page, the browser reloads the form via a clean GET request. It appears as though the form was reset and never submitted.
    3. Action Order: If the Redirect Action is placed before other actions (e.g., Save Submission, Send Email), its exit; call will terminate PHP before those subsequent actions ever run.

3. Discrepancy Between Frontend and Backend Conditions

Cornerstone has two different condition mechanisms:

  1. Cornerstone Element Conditions (native builder conditions evaluated server-side).
  2. Cornerstone Forms Input Conditions (evaluated client-side via JavaScript and server-side during form processing).

If conditional fields use native Element Conditions rather than Form Input Conditions, or if the condition’s Subject references an ID rather than the exact input Name, the backend will not recognize the condition state during POST processing. The backend will treat the field as visible, see that it is empty, and fail the required check.


Recommended Checks to Resolve the Issue

  1. Enable AJAX Submission (Fastest Fix):
    • Select your Form element in Cornerstone.
    • Under the form settings, toggle AJAX to ON (matching your development form).
  2. Disable “Error Inline” to Expose Hidden Errors:
    • In the Form settings, turn off Error Inline.
    • Submit the form again. If a hidden conditional field is failing validation, the error will now appear in the global error container at the top or bottom of the form, identifying the exact field causing the block.
  3. Verify the Redirect Action:
    • Ensure the Redirect action is the last action in your form’s action stack.
    • Verify the Location field contains a valid destination URL (e.g. /thank-you/).
  4. Check Conditional Field Configuration:
    • Ensure all conditional fields use Input Conditions (under the form input settings), not Cornerstone’s general element conditions.
    • Check that condition statements target the exact input Name of the controlling field.

I updated the secure note (with new access credentials) and disabled inline errors (that was a very helpful advice!!!). I narrowed it down to the following error:
“Email or Phone is required”

However, when I follow the flow of the form, I already select an option in
Πώς θέλεις να επικοινωνήσουμε μαζί σου;* (the question that is asking whether the user will be contacted by phone or email)
It’s a radio list with two options.
Email
Τηλέφωνο (in English "Telephone).

Could you please take a look? I think I’m missing something :confused:

Hey @agelada,

When naming form or any elements, make sure to use lowercase because it is neat, and DO NOT leave out empty character spaces:

The appropriate name for that element should be “email_phone”.

Thanks.

1 Like

Thank you!
Made the correction to the field name and the input conditions of the required fields, and everything works

You are most welcome, @agelada.
Good to know that your issue is now resolved.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.