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

  • SEARCH
  • Home
  • 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 6350135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:45:19+00:00 2026-05-24T21:45:19+00:00

I have a custom Form I’ve made that extends the Doctrine base forms for

  • 0

I have a custom Form I’ve made that extends the Doctrine base forms for a Doctrine object.

I have a database field that is type: boolean. For my form, I have this represented by a sfWidgetFormInputCheckbox() widget. When my form is submitted, the value of my checkbox comes back as on if it was checked and if it wasn’t checked, then no value is passed. Either way, when I do my $form->save(), the boolean field is not affected. Symfony/Doctrine wants to see a true or false. Not a on or no value at all.

My solution is just to see if the value was passed at all and if so, then that field is true else false:

$values['my_field'] = isset($values['my_field']) ? true : false;

Is this the proper way to handle this? I would think that Symfony/Doctrine would already understand how to handle checkboxes. I would expect it to know that if the value for the checkbox comes back as on then to set that value in the database as true and if it doesn’t exist, then it’s false.

Obviously my approach works… but what is the CORRECT approach?

  • 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-05-24T21:45:20+00:00Added an answer on May 24, 2026 at 9:45 pm

    sfValidatorBoolean returns true or false. If you are not getting true or false after binding the form, you are not using this validator.

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

Sidebar

Related Questions

I have a custom TagField form field. class TagField(forms.CharField): def __init__(self, *args, **kwargs): super(TagField,
I'm actually developping a custom form field type which extends a file form field
I have written a custom dialog (form) that I can use in a C#
I have a custom sharepoint aspx form that has an InputFormTextBox with RichText property
I have a scenerio where I want to dynamically render a custom form object.
I have a custom form that's returning the values to the main form but
Currently I have a custom form login page in Spring Security 3 that sends
I have a custom edit form made for ASPxGridView but have a big problem
I have a forms directory inside my application directory with custom form php files
I have a custom form which does not have any type of border. I'm

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.