Download the PHP package flsouto/htcheckb without Composer

On this page you can find all versions of the php package flsouto/htcheckb. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package htcheckb

HtCheckb

This library is used to create checkboxes.

Installation

Use composer:

Usage

The following example instantiates the checkbox class and renders it:

Output:

The extra hidden field is a submit flag which indicates if the checkbox has been sent (i.e. the form has been submited). This is important in the case you have a checkbox that is checked by default but is unchecked by the user. In case that a validation error occurs, the form must be shown again but with the checkbox unchecked (the default is ignored).

The next example renders the checkbox in readonly mode (chekcbox button disabled):

Output:

Notice that a second hidden field is rendered as well. This is because when you disable a form field it will not be sent by browsers, and it is important to mantain the state of the data on a submit event even if the field is on readonly mode.

Changing the defaults

By default, the checkbox understands "1" as true and "0" as false. It also is unchecked (state "0") by default. The below example changes all of that, so that 'true' means 'checked' and 'false' means unchecked. It also makes the field checked by default:

Outputs:

In the following example we are going to simulate a situation where the form is submited (notice the presence of 'newsletter_submit' flag) but the checkbox key (i.e. 'newsletter') is not present. This means the user would have unchecked the checkbox that was checked by default. So in this case the checkbox is rendered without the 'checked' attribute:

Outputs:

Last but not least, I want to show you that the checkbox can also represent the state of a supposed database row which uses the common Y/N pattern to indicate if it is active or not. Notice that the checkbox is rendered unchecked even though it is told to be checked by default:

Output:


All versions of htcheckb with dependencies

PHP Build Version
Package Version
Requires flsouto/htwidget Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package flsouto/htcheckb contains the following files

Loading the files please wait ....