FoxInCloud
switch checkbox
Gravatar is a globally recognized avatar based on your email address. switch checkbox
  Vincent H.
  All
  May 20, 2022 @ 01:01am

Hi Thierry,

It might be nice to integrate this new graphical representation of checkboxes (Bootstrap 5.1) ...

So far, I have very easily created a class from my base class, adding this code:

wcHTMLgen()
IF VARTYPE (toHTMLgen) = Cobjet
   toHTMLgen.cScriptJSAdd(TEXTMERGE ([jQuery('#<<THIS.wcID>>_div').removeClass().addClass("form-check form-switch");]))
ENDIF

And it works without any other addition!

Gravatar is a globally recognized avatar based on your email address. re: switch checkbox
  FoxInCloud Support - Thierry N.
  Vincent H.
  May 20, 2022 @ 01:26am

Cool, thanks a lot for the feedback.

Another nice surprise (from Bootstrap) is that the HTML and CSS class markup is the same regardless whether the checkbox is rendered classically or as a switch.

Please note you can simply add the switch-specific Bootstrap class without removing first all classes:

procedure wcHTMLgen
LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code

…
IF VARTYPE (toHTMLgen) = Cobjet
   toHTMLgen.cScriptJSAdd(TEXTMERGE ([jQuery('#<<THIS.wcID>>_div').addClass("form-switch");]))
ENDIF
…
© 1996-2024