Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #1028657 // htrickcheckboxWithText - HTML checkbox with trick that sends 0 if unchecked

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2780L/18K).

sS htrickcheckboxWithText(S name, S text, bool checked, O... params) {
  S id = randomID();
  ret hhidden(name, checked ? "1" : "0")
    + hcheckbox(null, checked, paramsPlus(params, +id, onclick := "this.previousElementSibling.value=this.checked ? 1 : 0"))
    + " " + hlabelFor(id, htmlEncode2(text));
}

sS htrickcheckboxWithText(S name, S text) {
  ret htrickcheckboxWithText(name, text, false);
}

Author comment

Began life as a copy of #1028495

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028657
Snippet name: htrickcheckboxWithText - HTML checkbox with trick that sends 0 if unchecked
Eternal ID of this version: #1028657/3
Text MD5: 6f5fba21ef6b09397d4d45aed385992c
Transpilation MD5: 8bcf8dd2a20ef2277df7808bd84ef186
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-02 12:44:25
Source code size: 410 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 151 / 223
Version history: 2 change(s)
Referenced in: [show references]