Drupal Content Type: how to add a checkbox that hides an object if checked?

Clinton Green

I am working on a Drupal site and I want to add a checkbox within a content type that will hide an object if checked.

I am not to worried about how to hide it, I can figure that out with Js or CSS later on but I need to know how to add a checkbox that has the ability to modify the display.

I think its going to be along the lines of adding a new field but I don't know what type of field to add.

Any help is greatly appreciated :)

JSunny

I have done this by adding form alter,

You need to write the form alter then you can add states property for the field you need to show or hide

$form['your_showhide_field']['#states'] = array(
            'visible' => array(
                ':input[name="you_checkbox_name"]' => array('checked' => true),
            ),
        );

OR

You can also use field condition state module to do this.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

How to add required validation to matInput if the checkbox is checked

How to add css to the mat-card background when mat-checkbox is checked which is inside the mat-card-content?

How to disable a checkbox when a second checkbox is checked?

How to read if a checkbox is checked in PHP?

how to calculate tax if checkbox checked

How to set checkbox with a certain value checked in jquery?

Binding.scala: how to define checked in a Checkbox

jquery how to make checkbox always checked

How to append element if checkbox is checked and remove it if unchecked?

How to check if checkbox is checked in Angular JS?

How to add a checkbox in SelectListActions

Certain content type not showing during search in drupal 6

jquery datable add checkbox for object initialised table

How to keep the checkbox inside gridview checked based on certain condition?

How to have the checkbox checked when editing my database

How to move item to the last position when Checkbox is checked? (RecyclerView, ViewHolder)

How to get the ID of parent Node on checkbox checked in jquery?

How can i display the last of my code only if the checkbox is checked?

How to change checkbox property checked to true or false within sweet alert

jQuery table - How to write text in cell depending on checkbox checked

How I set a checkbox to be always checked in product woocommerce?

How to enable / disable a button based on a checkbox being checked in Angular

How do i get the latest checked value of the checkbox?

Laravel Blade checkbox not checked

Checked checkbox should not be unchecked

Display error if no checkbox is checked in checkbox group

validate if checkbox has been checked

Checkbox always checked custom styling

AngularJS: tracking which checkbox is checked

TOP 一覧

  1. 1

    どのように関係なく、それがどのように「悪い」、すべてのSSL証明書でのHttpClientを使用しないように

  2. 2

    セレンのモデルダイアログからテキストを抽出するにはどうすればよいですか?

  3. 3

    Modbus Python Schneider PM5300

  4. 4

    System.Data.OracleClient.OracleException:ORA-06550:行1、列7:

  5. 5

    scala.xmlノードを正しく比較する方法は?

  6. 6

    インデックス作成時のドキュメントの順序は、Elasticsearchの検索パフォーマンスを向上させますか?

  7. 7

    Elasticsearch - あいまい検索は、提案を与えていません

  8. 8

    グラフ(.PNG)ファイルをエクスポートするZabbix

  9. 9

    Ansibleで複数行のシェルスクリプトを実行する方法

  10. 10

    変数値を含むElasticSearch検索結果

  11. 11

    Elasticsearchでサーバー操作を最適化:低いディスク透かしに対処する

  12. 12

    Python / SciPyのピーク検出アルゴリズム

  13. 13

    tkinterウィンドウを閉じてもPythonプログラムが終了しない

  14. 14

    テキストフィールドの値に基づいて UIslider を移動します

  15. 15

    Chromeウェブアプリのウェブビューの高さの問題

  16. 16

    NGX-ブートストラップ:ドロップダウンに選択したアイテムが表示されない

  17. 17

    Reactでclsxを使用する方法

  18. 18

    STSでループプロセス「クラスパス通知の送信」のループを停止する方法

  19. 19

    Pushwooshで削除されたアプリデバイストークンを処理する方法は?

  20. 20

    ラベルとエントリがpythontkinterに表示されないのはなぜですか?

  21. 21

    Elasticsearchの場合、間隔を空けた単語を使用したワイルドカード検索

ホットタグ

アーカイブ