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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:23:09+00:00 2026-06-10T02:23:09+00:00

I am trying to add a disabled checkbox using Zend_Form and then enable it

  • 0

I am trying to add a disabled checkbox using Zend_Form and then enable it with JS.

Here’s the problem, zend adds a hidden input field with the same name and the value 0. This is to make sure even if the checkbox is not checked a value of 0 will be sent rather than no value at all. This is great. But if you create your checkbox as disabled, zend does not output this hidden field. All it outputs is the checkbox, disabled, being checked or not (does not matter since it is disabled it wont submit anything at all).

I need to allow the client to enable the checkbox and change the value.

If it is disabled, nothing is submitted, the db checkbox value stays the same. If it is enabled the client should be able to check/uncheck it. The problem is now there is no hidden field, and if the checkbox is unchecked nothing is submitted.

Any ideas?

  • 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-10T02:23:10+00:00Added an answer on June 10, 2026 at 2:23 am

    First: I don’t like the way Zend handled this for you. Adding the hidden field with value 0 simply isn’t the same as a disabled checkbox, as you found out yourself.

    To solve your problem: Simply add a hidden field by yourself with the original state in it.

    eg:

    <INPUT type="hidden" name="originalStateOfMyCheckbox" value="enabled/disable">
    

    Now you can check the value of your checkbox by first checking the value of $_POST[“originalStateOfMyCheckbox”].

    If enabled: you can use isset($_POST[“yourcheckboxname”]) to find out if it was checked.

    If disabled: you can use again isset($_POST[“yourcheckboxname”]) to find out if your javascript enabled it.

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

Sidebar

Related Questions

Trying to add a class object into a List using reflection, but when invoking
Im am trying to add a check box that will enable/disable the edit button.
I'm trying to add a small lock icon to a disabled textfield / text
Using VS2008, I am trying to add an App_Code folder from add-->folder-->Add ASP_NET folder.
I am trying to test if a field is disabled properly in jasmine but
I am trying to add a section to the Home>Administration>Configuration page which then opens
I'm trying to make the rows of this table start out disabled and then
I am trying to add a SOAP service using VS 2005 via add web
I'm trying to re-enable the selected and disabled option from the drop-down list once
I'm trying to enable hover (adding '.add_link_twitter_hover' class) when the checkbox is not selected

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.