How to append a single option to a dbjoin element

mirceat

Member
Hello,

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:

HTML:
<select>
<option value="0">Please select</option>
<option value="1">Others</option>
...
rest of dynamic options here

Thank you
 
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".

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



Thank you
 
Last edited:
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. ...
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.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top