• 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.

Need button for selection first row (when some order is set) from "Popup form -Front-end-Select"

Hi,

I have on my form1
field: ___kp_zamawiajacy --- "Zamawiaj?cy" that is databasejoin and
i use for this element Popup form; " CC-21 - 37 - dopisywanie Zamawiaj?cych i ich Nr zam?wie?" - I use "Front-end-Select"

all what i need when use this "Front-end-Select" is to select first=on the top of list with records----- record.
In my table CC-21 - 37 - dopisywanie Zamawiaj?cych i ich Nr zam?wie?" i have in Data ___> Order by ccjom_cc_kk_ip2_zamowienia.id.

Need when is set this ordering choose/select first record from the top of my list.

This table is left join:
left JOIN ccjom_cc_kk_ip2_zamowienie ON ccjom_cc_kk_ip_zamawiajacy.id = ccjom_cc_kk_ip2_zamowienie.zam_zamaw


I need to do this operation more quickly and not use :
- icone with Front-end-Select
+
- click the first record on the top of this list
to get result datas jump to my form1

I need click one button "Wpisz ostatni Nr.zam." and to have this result - datas from record on top of my list see as jumped to my form1.

I try long time to write code in JavaScript to this button but this seems to be to much complicated to do this by myself.

Hmmm... Sample of code for button ---Javascript is here:
JavaScript:
$db =& JFactory::getDBO();
$query = $db->getQuery(true);


$query2 = 'SELECT `ip2_zamowienie_symbol1 ` FROM `ccjom_cc_kk_ip2_zamowienie` ORDER BY `id` DESC
LIMIT 1 ';
$db->setQuery($query2);
$result2 = $db->loadResult();

$query3 = 'SELECT `zam_zamaw` FROM `ccjom_cc_kk_ip2_zamowienie` ORDER BY `id` DESC
LIMIT 1 ';
$db->setQuery($query3);
$result3 = $db->loadResult();



$query1 = 'SELECT `ip_zamawiajacy_naz1` FROM `ccjom_cc_kk_ip_zamawiajacy` WHERE `ip_zamawiajacy_naz1`= ' .$result3. '';
$db->setQuery($query1);
$result1 = $db->loadResult();

$result4 = 'Firma GHIJKL';
$result5 = 'zam. 1234/2016';


// $formModel->_data['ccjom_cc_kk_karta_rejestr___kp_zamawiajacy_raw']=$result4;

// $formModel->_data['ccjom_cc_kk_karta_rejestr___zamow_symbol_raw']=$result5;


  
$('ccjom_cc_kk_karta_rejestr___kp_zamawiajacy_raw').value = 'Firma GHIJKL';

// $('ccjom_cc_kk_karta_rejestr___zamow_symbol_raw').value = zamow1;


Please any tips.
 

Attachments

  • Zaznaczenie_149.png
    Zaznaczenie_149.png
    49.5 KB · Views: 548
  • Zaznaczenie_150.png
    Zaznaczenie_150.png
    24.1 KB · Views: 555
  • Zaznaczenie_151.png
    Zaznaczenie_151.png
    36.6 KB · Views: 564
  • Zaznaczenie_152.png
    Zaznaczenie_152.png
    37.8 KB · Views: 544
  • Zaznaczenie_153.png
    Zaznaczenie_153.png
    114.4 KB · Views: 550
  • Zaznaczenie_154.png
    Zaznaczenie_154.png
    89.1 KB · Views: 556
  • Zaznaczenie_155.png
    Zaznaczenie_155.png
    54.1 KB · Views: 566
  • Zaznaczenie_156.png
    Zaznaczenie_156.png
    69.1 KB · Views: 569
  • Zaznaczenie_157.png
    Zaznaczenie_157.png
    26.3 KB · Views: 556
You are trying to run PHP in JavaScript. All that database query stuff is PHP. You can't run that in JavaScript. PHP runs on the server. JavaScript runs in the browser.

So do you need to popup that first form, or open it in a new page?

-- hugh
 
Back to what you want to achieve:
why do you need the "Frontend-select-popup" at all if you only want to have the first row?
Wouldn't it be sufficient to show only this one row in your dropdown?
 
troester:
In my form1 = "CC-21 - Formularz: Nowa karta produkcji"
- i have field:
ccjom_cc_kk_karta_rejestr___kp_zamawiajacy --- "Zamawiaj?cy" that is databasejoin --- this mean "Our Customer Name" and should be "autocomplete" not "dropdown" becouse of many numbers values for "Our Customer Names"

- i have also field:
ccjom_cc_kk_karta_rejestr___zamow_symbol - "Nr zam?wienia" that is cascadingdropdown ---- this means "Order number for some customer" - one customer can have multiple different "order numbers"

------------------------

In my popup-table CC-21 - 37 - dopisywanie Zamawiaj?cych i ich Nr zam?wie?" WHEN Order by ccjom_cc_kk_ip2_zamowienia.id ------ field ccjom_cc_kk_ip2_zamowienia.id is the ___id for "Order number".
WHEN ORDER BY ccjom_cc_kk_ip2_zamowienia.id --- means record with the newest "Order number" is on the top of list.

For many cases when i fulfill "main form1" ="CC-21 - Formularz: Nowa karta produkcji"
i should add with "+" --- "Add option in front end" :
- new "Order No" for existing "Customer_Name"
or
- new "Customer" + new (his first) "Order No"

When Add this with "+" = "Add option in front end" ---- i would need this newest record with "newest Order No" automatically jump to (was displayed in) my "autocomplete" field {ccjom_cc_kk_karta_rejestr___kp_zamawiajacy} for "customer" and cascading dropdown field {ccjom_cc_kk_karta_rejestr___zamow_symbol} for "Order No".

1. Action "Automatically jump" to" autocomplete" and to "cascading dropdown" fields is the best solution that i need.
2. But i can use also "Button"---JavaScript to select newest record with "customer that has the newest order No + this Oder No" if solution 1. is not possible.
.===========================


cheesegrits:

I need
a. Field: "Zamawiaj?cy" (that is autocomplete)- do with "add option in front end"- popup form ----> write/add "add new customer + newest Order No" ----- this i can to do
b. get this automatically jump to my field "autocomplete" and "cascading dropdown" instead using:
-----
c1. - Front-end-Select
+
c2. - select first record from the top of list with popup

-----
----- this i am asking about help how to solve this
 

Attachments

  • Zaznaczenie_159.png
    Zaznaczenie_159.png
    18.1 KB · Views: 532
  • Zaznaczenie_160.png
    Zaznaczenie_160.png
    13 KB · Views: 541
Last edited:
I think your best bet would be a button, with some "user AJAX". Have you used the user_ajax.php before?

-- hugh
 
This is too difficult for me.
I need this button when "edit record". My fields that i need fulfill with this button are empty becouse they were not published when i added new record.

I have read about "user Ajax" but have problem to do even more simply operation as:
Steep_1:
try with button update field - field:
JavaScript:
form_309.formElements.get('ccjom_cc_kk_karta_rejestr___dodat_karta_odl_r').update('1234 km');

Action: click
Nothing doesn't work

Steep_2:
should be update (when edit record) empty field databasejoin (is autocomplete and should be autocomplete), i can't find how to write code for databasejoin, try:
JavaScript:
form_309.formElements.get('ccjom_cc_kk_karta_rejestr___kp_zamawiajacy').update('Firma GHIJKL');
Action: click

Also doesn't work

Can you help me in steep_1 and steep_2 at the beginning?
 
Hi,
I am not experienced with user_ajax.php.
But, what seems look to be earlier problem --- i am not even to be able to update edited field (edited but still empty) in edited record with javascript --- try update with fixed value for:
-field: field
-field: databasejoin dropdown
this is described in my post #6.

Can i get any tips?
 
My problem is, I've forgotten everything I knew about how the 3.0 modal windowing works. We completely rewrote that for 3.1+, I haven't looked at that code in 2 years, and I didn't know it very well to begin with - it's complex. It would take a long time, like a day, to dust off my 3.0 test server, set up a test case, and re-learn how 3.0 does all the modal popups, before I could even start figuring out how to do what you need.

You are basically our last "heavy duty" 3.0 user. We can keep Fabrik 3.0 working for you, fix bugs and patch security holes. But we just don't have the resources to do this kind of custom coding.

I apologize, I wish I could help, and I really do appreciate you long standing as a Pro user. But at the moment I'm focusing on testing J! 3.5 on PHP 7, and simply don't have the time to do custom work on end-of-lifed versions of Fabrik and J!.

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

Thank you.

Members online

Back
Top