1. We suggest you do NOT update to Joomla 3.8.10 until we can resolve an issue it causes with caching in Fabrik. If you do install it, you'll need to disable Joomla's "System Cache" in the global System settings.
  2. Apologies for the recent server outage, a planned migration by our host provider to a new location turned into a bit of a nightmare.

How to append a single option to a dbjoin element

Discussion in 'Community' started by mirceat, Jan 12, 2018.

  1. mirceat

    mirceat Member

    Level: Community

    I need to add a single option to a dbjoin element, below default "Please select" option. I can't use the "Eval option" because i'm using placeholders in Where statement and the placeholder value should be updated via AJAX.

    So, what i need is to have something like this in a dbjoin element rendered as dropdown:

    <option value="0">Please select</option>
    <option value="1">Others</option>
    rest of dynamic options here
    Thank you
  2. mirceat

    mirceat Member

    Level: Community
    friendly bump..

    Please note that i tried to add the option using jquery (prepend) but then the option is displayed multiple times, i need to display it only once after "Please select".

    Code (Javascript):
    $("mytable___my_element").prepend('<option value="1">TEXT</option>');

    Thank you
    Last edited: Jan 16, 2018
  3. Bauer

    Bauer Well-Known Member

    Level: Supporter
    The key to making that work would be to be certain you have a row in the table used by the database element that has the PK value (id) of 1 and the text you want to display.

    This assumes the dbj options are ordered by 'id', which is the default. (i.e. there is no ORDER BY included in the 'Joins where and/or order by statement (SQL)' configuration of the dbj 'Data - where' tab.)

    Then, if you want that TEXT value to be dynamic, you would have to modify it using javascript. e.g. ...
    Code (Javascript):
    var myText = "Text used for option 1";
    JQuery("#mytable___my_element option[value=1]").text(myText);
    Also - if needed, put an OR condition in your WHERE condition to be sure '1' always gets included in the options.

Share This Page