Re: Checkboxes

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 19181
interpreted = N
texte = >This is not really a Webcatalog question, but really an HTML question. > >How can I use checkboxes for editing boolean fields in a database? > >With Radio buttons I can use this: >[theField]=1]CHECKED[/ShowIf]>On >[theField]=0]CHECKED[/ShowIf]>Off > >But what about checkboxes? The value tag sent by the browser does not >change according to the CHECKED state of the checkbox? > >VALUE=[theField] [showif [theField]=1]CHECKED[/ShowIf]> > >Does not work... Here's one way to fix it:Put this just BEFORE the ending tag:This will set the theField value to zero when the checkbox is NOT checked.This technique works because the checkbox doesn't set a value for theField when it's unchecked, so this hidden field sets that value instead. Of course, if the checkbox is checked, the form will pass TWO values for theField ...But since all browsers currently send variables in the order they read them, and since WebCat sets variables in the order it receives them -- and since WebCat does NOT reset a value once it's been set -- this technique works now and will continue to work, at long as the hidden field appears AFTER the checkbox field in the form (and as long as browsers continue to pass variables in the order they appear in the form).One word of warning:HTML specs do *not* require browsers to send form variables in the order they appear in the form. Sure, it's common sense to do so -- and it's easier for browser authors to do it this way -- but it is not a requirement, so there may come a day when some browser will be programmed to pass form variables in a different order. If that even happens, and if the hidden field happens to get passed BEFORE the checkbox field, this technique won't work anymore.Sincerely, Ken Grome 808-737-6499 WebDNA Solutions mailto:ken@webdna.net http://www.webdna.net Associated Messages, from the most recent to the oldest:

    
  1. Re: [OT] Checkboxes! Javascript? ( "WebDna @ Inkblot Media" 2005)
  2. Re: [OT] Checkboxes! Javascript? ( Clint Davis 2005)
  3. Re: [OT] Checkboxes! Javascript? ( Marc Thompson 2005)
  4. Re: [OT] Checkboxes! Javascript? ( "WebDna @ Inkblot Media" 2005)
  5. Re: [OT] Checkboxes! Javascript? ( Marc Thompson 2005)
  6. [OT] Checkboxes! Javascript? ( "WebDna @ Inkblot Media" 2005)
  7. Re: JavaScript: Select All Checkboxes (Clint Davis 2001)
  8. Re: JavaScript: Select All Checkboxes (David Anderson 2001)
  9. JavaScript: Select All Checkboxes (Clint Davis 2001)
  10. Re: Fwd: checkboxes (Webmaster@4GDATA.com 2000)
  11. Re: Fwd: checkboxes (John Peacock 2000)
  12. Re: Fwd: checkboxes (Webmaster@4GDATA.com 2000)
  13. Re: Fwd: checkboxes (John Peacock 2000)
  14. Re: Fwd: checkboxes (Joseph D'Andrea 2000)
  15. Re: Fwd: checkboxes (John Peacock 2000)
  16. Fwd: checkboxes (Joseph D'Andrea 2000)
  17. Re: checkboxes (Webmaster@4GDATA.com 2000)
  18. FW: checkboxes (Webmaster@4GDATA.com 2000)
  19. Re: [checkboxes] and webcat (Joseph D'Andrea 2000)
  20. Re: [checkboxes] and webcat (Serban Constantinescu 2000)
  21. Re: [checkboxes] and webcat (Charles Kline 2000)
  22. [checkboxes] and webcat (2) (Serban Constantinescu 2000)
  23. Re: [checkboxes] and WebCat (2) (Jesse Proudman 2000)
  24. [checkboxes] and webcat (Serban Constantinescu 2000)
  25. Re: writing checkboxes to a database (The Mooseman 2000)
  26. Re: writing checkboxes to a database (Richard 2000)
  27. Re: writing checkboxes to a database (Richard 2000)
  28. Re: writing checkboxes to a database (Kenneth Grome 2000)
  29. Re: writing checkboxes to a database (Bob Minor 2000)
  30. writing checkboxes to a database (Richard 2000)
  31. Re: question about checkboxes (Bob Minor 1999)
  32. Re: question about checkboxes (Ricky Patten 1999)
  33. Re: question about checkboxes (Kenneth Grome 1999)
  34. question about checkboxes (Mike Jones 1999)
  35. Tiny Store / Checkboxes (John Hill 1998)
  36. Checkboxes and neSKUdata=[blank] (Chris W. 1998)
  37. Re: BIG PROBLEMS with Checkboxes!!! (Chris W. 1998)
  38. Re: BIG PROBLEMS with Checkboxes!!! (Chris W. 1998)
  39. BIG PROBLEMS with Checkboxes!!! (Chris W. 1998)
  40. BIG PROBLEMS with Checkboxes!!! (Chris W. 1998)
  41. Re: BIG PROBLEMS with Checkboxes!!! (Rob Marquardt 1998)
  42. Re: BIG PROBLEMS with Checkboxes!!! (Rob Marquardt 1998)
  43. Checkboxes on forms?? (Scott Szretter 1998)
  44. Re: Checkboxes on forms?? (Dave MacLeay 1998)
  45. RE: Checkboxes to add to cart... (Jay Van Vark 1998)
  46. RE: Checkboxes to add to cart... (Rob Marquardt 1998)
  47. Re: Checkboxes to add to cart... (PCS Technical Support 1998)
  48. RE: Checkboxes to add to cart... (Pat McCormick 1998)
  49. Checkboxes to add to cart... (Jim V 1998)
  50. Re: Checkboxes (Peter Ostry 1998)
  51. Re: Checkboxes (Charles Kefauver 1998)
  52. Re: Checkboxes (Peter Ostry 1998)
  53. Re: Checkboxes (Rob Marquardt 1998)
  54. Re: Checkboxes (Charles Kefauver 1998)
  55. Re: Checkboxes (Rob Marquardt 1998)
  56. Re: Checkboxes (Charles Kefauver 1998)
  57. Re: Checkboxes (Rob Marquardt 1998)
  58. Re: Checkboxes (Charles Kefauver 1998)
  59. Re: Checkboxes (Charles Kefauver 1998)
  60. Re: Checkboxes (Kenneth Grome 1998)
  61. Re: Checkboxes (Rob Marquardt 1998)
  62. Checkboxes (Charles Kefauver 1998)
  63. Re: multiple selected Checkboxes (Sue Ann Sanders 1998)
  64. Re: multiple selected Checkboxes (Peter Ostry 1998)
  65. multiple selected Checkboxes (Sue Ann Sanders 1998)
  66. Re: Updating checkboxes made easy !!! (Laurent Pladys 1998)
  67. Re: Updating checkboxes made easy !!! (Dave MacLeay 1998)
  68. Re: Updating checkboxes made easy !!! (Laurent Pladys 1998)
  69. Re: Updating checkboxes made easy !!! (Laurent Pladys 1998)
  70. Updating checkboxes made easy !!! (Laurent Pladys 1998)
  71. Re: Updating checkboxes made easy !!! (Dave MacLeay 1998)
  72. Re: Updating checkboxes made easy !!! (Bob Minor 1998)
  73. Re:Multiple appends with checkboxes (Jay Van Vark 1998)
  74. Multiple appends with checkboxes (Gil Poulsen 1998)
  75. Re: Checkboxes (dwilfong@world-wide-art.com (David Wilfong) 1997)
  76. Re: Checkboxes (Kenneth Grome 1997)
  77. Checkboxes (dwilfong@world-wide-art.com (David Wilfong) 1997)
  78. Re: possible, WebCat2.0 and checkboxes-restated (Grant Hulbert 1997)
  79. Re: possible, WebCat2.0 and checkboxes-restated (grichter@panavise.com (Gary Richter) 1997)
  80. Re: possible, WebCat2.0 and checkboxes-restated (Grant Hulbert 1997)
  81. possible, WebCat2.0 and checkboxes-restated (grichter@panavise.com (Gary Richter) 1997)
  82. Re: Is this possible, WebCat2.0 and checkboxes (Grant Hulbert 1997)
  83. Is this possible, WebCat2.0 and checkboxes (grichter@panavise.com (Gary Richter) 1997)
  84. Re: WebCat2b13 Mac plugin - [sendmail] and checkboxes (Kenneth Grome 1997)
  85. Re: WebCat2b13 Mac plugin - [sendmail] and checkboxes (Grant Hulbert 1997)
  86. Re: WebCat2b13 Mac plugin - [sendmail] and checkboxes (Kenneth Grome 1997)
  87. Re: WebCat2b13 Mac plugin - [sendmail] and checkboxes (grichter@panavise.com (Gary Richter) 1997)
  88. WebCat2b13 Mac plugin - [sendmail] and checkboxes (Kenneth Grome 1997)
>This is not really a Webcatalog question, but really an HTML question. > >How can I use checkboxes for editing boolean fields in a database? > >With Radio buttons I can use this: >[theField]=1]CHECKED[/ShowIf]>On >[theField]=0]CHECKED[/ShowIf]>Off > >But what about checkboxes? The value tag sent by the browser does not >change according to the CHECKED state of the checkbox? > >VALUE=[theField] [showif [theField]=1]CHECKED[/ShowIf]> > >Does not work... Here's one way to fix it:Put this just BEFORE the ending tag:This will set the theField value to zero when the checkbox is NOT checked.This technique works because the checkbox doesn't set a value for theField when it's unchecked, so this hidden field sets that value instead. Of course, if the checkbox is checked, the form will pass TWO values for theField ...But since all browsers currently send variables in the order they read them, and since WebCat sets variables in the order it receives them -- and since WebCat does NOT reset a value once it's been set -- this technique works now and will continue to work, at long as the hidden field appears AFTER the checkbox field in the form (and as long as browsers continue to pass variables in the order they appear in the form).One word of warning:HTML specs do *not* require browsers to send form variables in the order they appear in the form. Sure, it's common sense to do so -- and it's easier for browser authors to do it this way -- but it is not a requirement, so there may come a day when some browser will be programmed to pass form variables in a different order. If that even happens, and if the hidden field happens to get passed BEFORE the checkbox field, this technique won't work anymore.Sincerely, Ken Grome 808-737-6499 WebDNA Solutions mailto:ken@webdna.net http://www.webdna.net Kenneth Grome

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Thanks ! (1997) [OT] "Hacker Safe" (2007) How to include weather (2000) Locking up with WebCatalog... (1997) Digest Version (2000) WebTrends (2002) Caching pages...again (2001) stopping/restarting service on NT? (1998) WebDNA Solutions ... sorry! (1997) Roundup function? (1997) more ! testing (1997) Bad Cookie (1998) no template caching (1997) Assigning carts (1998) docs for WebCatalog2 (1997) WebCat2b13MacPlugin - [math][date][/math] problem (1997) Is there a way to just get to the last record in the database? (1997) Date Formats (1997) WebCat2b12 CGI Mac -- Problems propagating the cart through frames...still (1997) Problem with version 4 browsers (1998)