1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice
  2. If you update to Joomla 3.9.16, you will have to update Fabrik from the latest GitHub version, to fix a bug introduced in Joomla, which makes it impossible to list front end folder locations in backend JForms. This affects things like template selection.
    Dismiss Notice

How to code in java to get checkboxes not value but label?

Discussion in 'Standard Support' started by blue-mouse, Aug 24, 2015.

  1. blue-mouse

    blue-mouse Member

    Level: Community
    I use for an element javascript code, action: load

    Here is a piece of this code
    Code (Javascript):
    var tocs = Fabrik.getBlock('form_320').formElements.get('ccjom_cc_kk_karta_rejestr___is_dodatkowe2').getValue();
    $('ccjom_cc_kk_karta_rejestr___dd_tocs').value = tocs;

    is in fabrik a way to get for:
    var tocs_label = Fabrik.getBlock('form_320').formElements.get('ccjom_cc_kk_karta_rejestr___is_dodatkowe2').getValue();

    not Value of checkbox but labels?
    How to code:
    var tocs = Fabrik.getBlock('form_320').formElements.get('ccjom_cc_kk_karta_rejestr___is_dodatkowe2').get---Labels---();
    /
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Unfortunately not easily, no. Checkboxes in HTML don't really have "labels", it's just text rendered next to the input field. We wrap checkboxes in a label tag, which you could get the text attribute for, like ...

    Code (Text):
    Fabrik.getBlock('form').formElements.get('fab_junk___chbox').element.getElements('label')[0].get('text')
    ... but of course you'd need to iterate through all the subelements, find the ones which are selected, and get the label text for just those. Like I said, not easy.

    -- hugh
     

Share This Page