%3 ::xowiki::formfield::select ::xowiki::formfield::select initialize render_input ::xowiki::formfield::enumeration ::xowiki::formfield::enumeration add_statistics answer_is_correct config_from_category_tree get_labels ggw initialize make_correct pretty_value render_input render_label_classes render_label_text render_result_statistics scores stats_record_detail value_if_nothing_is_returned_from_form ::xowiki::formfield::select->::xowiki::formfield::enumeration ::xowiki::formfield::ShuffleField ::xowiki::formfield::ShuffleField ::xowiki::formfield::enumeration->::xowiki::formfield::ShuffleField ::xowiki::formfield::bootstrap-select ::xowiki::formfield::bootstrap-select initialize render_input ::xowiki::formfield::bootstrap-select->::xowiki::formfield::select

Class ::xowiki::formfield::bootstrap-select

::xowiki::formfield::bootstrap-select[i] create ...

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xowiki::formfield::select[i]
::xotcl::Class create ::xowiki::formfield::bootstrap-select \
     -superclass ::xowiki::formfield::select

Methods (to be applied on instances)

  • initialize (scripted)

    next
    ::xo::Page requireCSS "https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css"
    template::add_script -order 20 -src "https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"
    security::csp::require script-src https://cdn.jsdelivr.net
    security::csp::require style-src https://cdn.jsdelivr.net
  • render_input (scripted)

    
    set value [:value]
    #set :data-live-search true
    set :CSSclass "selectpicker form-control"
    set atts [:get_attributes id name data-live-search {CSSclass class} {placeholder title}]
    set disabled_p [:is_disabled]
    if {$disabled_p} {lappend atts disabled true}
    if {${:multiple}} {lappend atts multiple ${:multiple}}
    if {!${:required}} {
      set :options [linsert ${:options} 0 [list "--" ""]]
      set :descriptions [linsert ${:descriptions} 0 ""]
    }
    
    if {[llength ${:options}] != [llength ${:descriptions}]} {
      error "incorrect number of descriptions provided ([llength ${:descriptions}]): must be [llength ${:options}]"
    }
    
    ::html::select $atts {
      foreach o ${:options} d ${:descriptions} {
        lassign $o label rep
        set :opt_description $d
        set atts [:get_attributes {opt_description data-subtext}]
        if {$disabled_p} {lappend atts disabled true}
        lappend atts value $rep
        #:msg "lsearch {$value} $rep ==> [lsearch $value $rep]"
        if {$rep in $value} {
          lappend atts selected selected
        }
        ::html::option $atts {::html::t $label}
        ::html::t \n
      }
    }
    :handle_transmit_always $value