Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:19:54+00:00 2026-06-18T16:19:54+00:00

I have a contact form on Symfony2 where I put some validators as email,

  • 0

I have a contact form on Symfony2 where I put some validators as email, minLength etc.
All those fields are also set as notBlank.

Due to this, HTML5 is also validating those fields (for the email and not blank), which is fine for me.

I have a submit button:

<input type="submit" value="Submit"/>

The problem is that I have another submit button which is a Cancel button:

<input name="cancel" type="submit" value="Cancel" />

With this button, in my controller I am doing a redirect:

if( $request->get('cancel') == 'Cancel' )
    return  $this->redirect($this->generateUrl('SciForumVersion2Bundle_homepage'));

Now, due to the HTML5 validation, I can’t redirect because the fields are empty for example.

To reslove that, I have found two solutions, but I don’t like them:

  1. Disable the HTML 5 validation:

    <form novalidate>
    
  2. Use JavaScript

But as I said, I don’t like those methods and I am sure that there are some nice Symfony methods to resolve that.

Any idea? Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:19:55+00:00Added an answer on June 18, 2026 at 4:19 pm

    i resume my comment 🙂

    when dealing with form (HTML5 or not) and you want to quit, you don’t need to submit and validate any data
    You just have to put a simple href link to change the page. Use your favorite css style to have the same look

    Tip: you could listen to javascript event “onbeforeunload” when user has changed an input value. It alerts the user that he will quit the page

    Hope it helped !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a contact form with some fields like Name, Email, Subscribe. The Subscribe
i have one contact form, when user submit all value will send(email) to admin.But
I have a contact form in my flash file with name/email/message fields which a
I have a contact form and I have some fields that are validated by
I have a contact form which asks users for their name, email address and
i have a contact form sending itself to me by email using ASP classic,
I have a contact form where the email is actually accessible in the source,
I have a contact form which requires a name, method of contact (email or
I have a contact form that checks if some field is empty when you
I have a contact form that is being submitted, I have PHP validation all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.