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

Autofill Plugin doesn't work (doesn't show on Plug-in dropdown selection)

Discussion in 'Community' started by Indrit, Nov 19, 2020 at 12:26 AM.

  1. Indrit

    Indrit Member

    Level: Community
    Hi, I am having hard time to locate and select the recently installed plug-in "autofill"

    I installed it from download area. When I try to create a new element and select "autofill" I cant find it in the dropdown.

    Am I missing something???

    [​IMG]

    when I look at my installed Plug-Ins I can see the "autofill" being installed

    [​IMG]

    What am I missing??

    Thanks, Indrit
     
    Last edited: Nov 19, 2020 at 12:37 AM
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Check if it's enabled.
    And: it's a form plugin, no element plugin.
     
  3. Indrit

    Indrit Member

    Level: Community
    ahhh silly me. :) Thanks

    So, here is what I am trying to accomplished.

    I have this form (see image below) and I am trying to add the autofill plug in so that when the "Element of performance" field is selected the autofill will pick ONLY the first 4 characters and will show something like "EP11" in another field and ignore the rest of the sentence.

    Also How do I add another field that will be autofilled by what ever is selected on the "Elements of performance"??

    [​IMG]
     
    Last edited: Nov 20, 2020 at 12:26 AM
  4. troester

    troester Well-Known Member Staff Member

    Level: Community
    This is not what the autofill plugin is for (it is for pulling multiple values from an other table into form fields).

    Must this "other" field be editable or should it just display (and store)?
    If it's not editable use a calc element returning the 4 characters.
    If it must be editable use element JS to copy from one field to the other one.
     
  5. Indrit

    Indrit Member

    Level: Community
    Here is my answer to your question

    Must this "other" field be editable or should it just display (and store)? It will simply display and store. (Not editable)

    How can I use the calc element to return the 4 characters. where should I start?

    I assume I still have to create a element (text) and use it for the purpose of the calculation??

    [​IMG]

    So.., all those elements (Standard, Element Of Performance, EP Autofill) are part of the same list.

    Which element I need to edit and add calculation so that what ever the 1st 4 characters are on the Element "Element of Performance" will automatically show on the element "EP Autofill"


    Thanks, Indrit
     
    Last edited: Nov 20, 2020 at 5:39 PM
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
  7. Indrit

    Indrit Member

    Level: Community
    Thanks, I got the CALC plugin and installed, Elements created and now the hard part, .... at lest for me

    what is the php string

    $myCalc = (int)'{survey_dashboard___element_of_performance}' * 5;
    return $myCalc;
    $firstFourCharacters = substr($string, 0, 4);


    I now see nothing on the EP Autofill field

    I don't think I have this right
     
  8. troester

    troester Well-Known Member Staff Member

    Level: Community
    Nothing will run after a return.

    $string = '{survey_dashboard___element_of_performance}' ;
    return substr($string, 0, 4);
     
  9. Indrit

    Indrit Member

    Level: Community
    Thanks, I did make the changes and now I still have this

    [​IMG]


    I noticed on your string there is no $myCalc =
    What is the code I need to copy and paste
     
  10. troester

    troester Well-Known Member Staff Member

    Level: Community
    What do you want with $myCalc, this is only example code in the WIKI.
    You must return your substring.

    Did you enable "Ajax calculation"?
     
  11. Indrit

    Indrit Member

    Level: Community
    ... of course not :)

    I did enable it and it works like a charm. Thx!!!
     
  12. Indrit

    Indrit Member

    Level: Community
    How would I go if I want to add more to it?

    Here is what I mean: Instead of capturing only 4 characters as resolved I previous forum thread, I can capture all characters from element "Code" and only first 4 characters from element "Element of Performance". and make them display (example EC.02.01.03 EP4)

    BTW here are the elements as they appear in my database:
    Label: Code
    Full element Name: survey_dashboard___code

    Label: Element of Performance
    Full element Name: survey_dashboard___element_of_performance

    See pic below for details.

    [​IMG]


    After a few experiments i got this code who gives me only half of my solutions

    $string1 = '{survey_dashboard___code}' ;
    $string2 = '{survey_dashboard___element_of_performance}' ;
    return "$string1. substr($string2, 0, 4)";



    Still cant figure out the second part where I only need to capture first 4 characters.



    Thanks, Indrit
     
    Last edited: Nov 22, 2020 at 8:47 PM
  13. troester

    troester Well-Known Member Staff Member

    Level: Community
  14. Indrit

    Indrit Member

    Level: Community
    Thanks, I have seen that but I could not make any sense for the second part of my problem

    I know if I do

    $string1 = '{survey_dashboard___code}' ;
    $string2 = '{survey_dashboard___element_of_performance}' ;
    return "$string1. $string2";


    It will combine both strings, but I dont want that. I want all characters from the first string, and ONLY first 4 characters from the second string. I am falling short.

    $string1 = '{survey_dashboard___code}' ;
    $string2 = '{survey_dashboard___element_of_performance}' ;
    return "$string1. $string2";

    $string2 is where I can't figure out how to make it to only display first 4 characters.
     
  15. troester

    troester Well-Known Member Staff Member

    Level: Community
    This is just php
    ...
    return $string1 . substr($string2, 0, 4);
     
  16. Indrit

    Indrit Member

    Level: Community
    Thank you! Much appreciated!

    I updated a little to create a space between string1 and string 2

    return $string1." ".substr($string2, 0, 4);
     

Share This Page