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 8713437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:20:45+00:00 2026-06-13T05:20:45+00:00

I have a problem with a sfWidgetFormInputCheckbox. It do not save false in the

  • 0

I have a problem with a sfWidgetFormInputCheckbox. It do not save false in the database when the checkbox is unchecked.

In my schame my field is a boolean, and i don’t have bug in the value displayed.

Set the default value like this : $this->setDefault('status', false); don’t work either.

My widget :

$this->widgetSchema['SUSPENSION_TEMP'] = new sfWidgetFormInputCheckbox();
$this->validatorSchema['SUSPENSION_TEMP'] = new sfValidatorBoolean(array('required' => false));

The default :

$this->setDefault('SUSPENSION_TEMP', false);

Any ideas ?

Edit:

It save 1 when the checkbox is checked. And do not change the database value when you unchecked and save. So once you checked once, value is always 1 in database (true for my code).

Edit2:

I have two clues to add. If the field is an integer in the schema.xml, both values work, bu we got a poblem on value displayed (checkbox checked qih the 0 value). Here, he field is a boolean.

The setter receive two kinds of value, ‘on’ when checkbox is checked and true when it’s not. I tried to set default value to false in form, and to overide he setter. Both don’t work.

I mean the setter work, but for an unknown reason the basic seer is called right after with a wrong value.

Edit3:

Ok, i understand part of the problem. The setter is not called, when the checkbox is unchecked. I thought it was because, m code displayed a var_dump(). It was because later i copy the old version of this object in archive purpose.

But symfony should detect that the field has been rendered and it doesn’t. I don’t know why. I know why in html, but obviously symfony should be able to tell himself “hey, i add a checkbox here”.

Is there an elegant way o do this, or should i checked it by hand ?

  • 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-13T05:20:46+00:00Added an answer on June 13, 2026 at 5:20 am

    The problem came from my form handling. My legacy code, did no render all fields (ex : some stamp field, updated by a behavior). It was using fromArray, then save. This update only the fiels rendered.

    The traditionnal symfony form, give null to all non-rendered fiels in order to chcuk for required validation.

    So you need to check by yourself and set to 0, when you are using a fromArray then save. Still, i find the form->save really dumb, because you need to send useless(in this case) or confidentials data to your client in order to use it.

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

Sidebar

Related Questions

I have problem SIMILAR to preventing form data reposting, but not quite the same
I have problem with my code. I don't know what am I doing wrong.
I have problem in generating or getting decimal value in python. for now, I
I have problem with getting value of parameter when I have variable with some
I have problem with Uploadify: I log in the project using: FormsAuthentication.SetAuthCookie(myName, false); Then,
I have problem with reading buffer, when reading is not completed. If the received
I have problem in my xampp server php file not work if I write
I have problem with comparing the value of array elements. e.g. I wanted to
I have problem with Dictionary(buzzCompaignsPerUserIntersets) . I have dictionary (key = stringand value =
I have problem with getting rows from my database using Hibernate. When I would

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.