Show list in form problem

sob_k

Member
Hey everyone
I have form named "sprawa" and in this form I display (in group in Intro) list "sprawa_17_repeat" with this code:
Code:
{fabrik view=list id=30 sprawa_17_repeat___parent_id=[rowid]}

In form "sprawa" I created button to add new record to the list "sprawa_17_repeat"

JavaScript:
var parent_id =Fabrik.getBlock('form_3').formElements.get('sprawa___id').getValue();
var url = "/sprawa/form/30/?sprawa_17_repeat___parent_id=" + parent_id + "&ajax=1&format=partial";
Fabrik.getWindow({
   id: 'add_note',
   contentType: 'html',
   contentURL: url,
   loadMethod: 'xhr',
   title: 'Dodaj notatke',
                 width: 600,
                 height: 450,
                 'minimizable': false,
                 'collapsible': false
});

Of course, the list "sprawa_17_repeat" has a custom template without < form></form> to don't brake main form "sprawa"
Now, when I add new record to the list "sprawa_17_repeat" , after add the list "sprawa_17_repeat" disappears in from "sprawa" but when I reload (not refresh F5 - because did not work) form "sprawa" list is display again properly with a newly added reekord.

The question is, what should I add to the form list "sprawa_17_repeat" so that after adding the record it reloads the main form "sprawa" and displays the list "sprawa_17_repeat" again properly.
It would be good to use refresh page in ajax
Something similar to note plugin
 
Last edited:
Not sure what you mean by ...

Now, when I add new record to the list "sprawa_17_repeat" , after add the list "sprawa_17_repeat" disappears in from "sprawa"

You mean the list literally disappears?

-- hugh
 
Hej, Yes list display in form disappears (ok maybe not disappears but is empty :) ) , but when I reload form - record in list is visible again with a newly added record
 
Last edited:
these are screenshots
Step 1 view form and tab with a list
Step 2 adding a record to he list
Step 3 confirmation of adding a record
Step 4 is after add properly record. List still look empty.
Step 5 after reload form
 

Attachments

  • step4.PNG
    step4.PNG
    21.8 KB · Views: 117
  • step3.PNG
    step3.PNG
    25.7 KB · Views: 123
  • step2.PNG
    step2.PNG
    33.4 KB · Views: 101
  • step1.PNG
    step1.PNG
    18 KB · Views: 112
  • step5.PNG
    step5.PNG
    21.7 KB · Views: 321
Last edited:
Ah, OK, so it's not disapearing.

OK, you can solve that with some custom JS on your form, in a ./component/com_fabrik/js/form_X.js file, where X is your numeric form ID.

Code:
requirejs(['fab/fabrik'], function () {
   Fabrik.addEvent('fabrik.form.submit.end', function () {
      // replace with the list ID, check your page source to get it
      var list = Fabrik.getBlock('list_123_com_fabrik_123');
      list.updateRows();
   });
});

That event code should fire after a successful form submit, and kick off an updateRows() on the list.

-- hugh
 
Ok my file is
form_30.js
with:
Code:
requirejs(['fab/fabrik'], function () {
   Fabrik.addEvent('fabrik.form.submit.end', function () {
      // replace with the list ID, check your page source to get it
      var list = Fabrik.getBlock('listform_30_com_content_30');
      list.updateRows();
   });
});
I try also with list_30_com_fabrik_30
But still not working :-(
Ps.
File 1.png - after add record
File 2.png - when reload main form
 

Attachments

  • 1.PNG
    1.PNG
    68 KB · Views: 91
  • 2.PNG
    2.PNG
    101.3 KB · Views: 100
Last edited:
Open your dev tools (ctr-shift-i in Chrome). Find that form_30.js file in the "Sources" tab, and put a breakpoint on the "var list" line. See if the break happens when you save the form.

-- hugh
 
I have this : list is undefined and error

Uncaught TypeError: list.updateRows is not a function
at Object.<anonymous> (VM200 form_30.js:6)
at Object.<anonymous> (fabrik.js:3)
at Array.forEach (<anonymous>)
at Function.forEach (mootools-core.js?95b32b431d09e214e5445d46c2c6e70b:5)
at Array.each (mootools-core.js?95b32b431d09e214e5445d46c2c6e70b:9)
at Object.f.fireEvent.f.trigger (fabrik.js:3)
at Object.<anonymous> (form.js:3)
at Object.check (form-submit.js:3)
at Object.e.extend.$owner (mootools-core.js?95b32b431d09e214e5445d46c2c6e70b:38)
at mootools-core.js?95b32b431d09e214e5445d46c2c6e70b:21
 

Attachments

  • code.PNG
    code.PNG
    71.3 KB · Views: 262
Last edited:
OK, so when it stops at that line, in the console, type ...

Fabrik.blocks.

... and it should pop up a dropdown with all the options in 'blocks', which should include your list. Make sure that's the string you are using in your code.

Or you can look in the Scope section over on the right of the dev tools window, and drill down to the Fabrik.blocks object to see what's in it.

-- hugh
 
unfortunately no
My scope (new2.png)
After add record I have error (new3.png)
 

Attachments

  • new2.PNG
    new2.PNG
    38.9 KB · Views: 113
  • new3.PNG
    new3.PNG
    114.7 KB · Views: 277
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top