1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

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

Discussion in 'Professional Support' started by blue-mouse, Feb 12, 2016.

  1. blue-mouse

    blue-mouse Member

    Level: Community
    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:
    Code (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.
     

    Attached Files:

  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    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
     
  3. troester

    troester Well-Known Member Staff Member

    Level: Community
    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?
     
  4. blue-mouse

    blue-mouse Member

    Level: Community
    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
     

    Attached Files:

    Last edited: Feb 12, 2016
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I think your best bet would be a button, with some "user AJAX". Have you used the user_ajax.php before?

    -- hugh
     
  6. blue-mouse

    blue-mouse Member

    Level: Community
    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:
    Code (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:
    Action: click

    Also doesn't work

    Can you help me in steep_1 and steep_2 at the beginning?
     
  7. blue-mouse

    blue-mouse Member

    Level: Community
    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?
     
  8. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    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
     

Share This Page