• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

How to code in fabrik+java to get element value from last row?

Hi,
I need to make button as an element in my form with action when click it:
do: select current databasejoin-dropdown element value:
{ccjom_cc_kk_karta_rejestr___ip_zamaw_zam}
select the same value like the value of this element in last row/record in the same table
table and form is '309'.

with php code i can get this element value from last row with code:
Code:
$db =& JFactory::getDBO();
$query1 = "SELECT `ccjom_cc_kk_karta_rejestr___ip_zamaw_zam ` FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2' ORDER BY `id` DESC
LIMIT 1 ";
$db->setQuery($query1);
$result1 = $db->loadResult();
return $resultt1;

I can also write java plugin code with fabrik identifier like this:
JavaScript:
var pozycja = Fabrik.getBlock('form_309').formElements.get('ccjom_cc_kk_karta_rejestr___zamow_positon_number').getValue();

var poz1 = Number(pozycja);
var dodaj = 1;
var dod1 = Number(dodaj);

var suma = poz1 + dod1;

$('ccjom_cc_kk_karta_rejestr___zamow_positon_number').value = Number(suma);

that change value in other element when click another button.

So, problem is how to get from ('list_309') value of "last"-element: (condition: WHERE `rodzaj_karty_np_wzorzec`='2')

('ccjom_cc_kk_karta_rejestr___ip_zamaw_zam')
?

i try this code, but this is not this what should be:
JavaScript:
var zamaw1 = Fabrik.getBlock('list_309').formElements.get('ccjom_cc_kk_karta_rejestr___ip_zamaw_zam').getValue();

$('ccjom_cc_kk_karta_rejestr___ip_zamaw_zam').value = 'zamaw1';
 
Last edited:
You'll need to do an AJAX call. Have a look at ./components/com_fabrik/user_ajax_example.php, which lays out how to go about doing this sort of thing.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top