[Repeatable] Display multidimensional array results by Ajax

premierhw

Member
Hello again,

I need to display database info (which are stored by repeatable) to form fields using Ajax + jQuery.

I could manage to display single elements and first row info of repeat group however
I cannot display after 2nd rows of repeat group. I would like to know how could I display them?

When I check 'Net work: Preview' with F12 button, the data are sent as :

Code:
0: {id:1, parent_id:1, mc_no:2, mc_dim:32, mc_gw:3, mc_nw:2.6, mc_dimw:24, mc_dimd:65}
id: "1"
mc_dim: "32"
mc_dimd: "65"
mc_dimw: "24"
mc_gw: "3"
mc_no: "2"
mc_nw: "2.6"
parent_id: "1"
1: {id:2, parent_id:1, mc_no:3, mc_dim:45, mc_gw:1, mc_nw:0.7, mc_dimw:65, mc_dimd:43}
id: "2"
mc_dim: "45"
mc_dimd: "43"
mc_dimw: "65"
mc_gw: "1"
mc_no: "3"
mc_nw: "0.7"
parent_id: "1"
cera_cnu: "["0","1","2","3"]"
cera_material: "7"
cera_notes: "test cera"

I am wondering even I could output above information, is it possible to increment the table rows without clicking '+' button?

Any help is greatly appreciated :)
Thank you in advance!
 

Attachments

  • 2013-05-22_1428.png
    2013-05-22_1428.png
    45.6 KB · Views: 322
Friendly bump please :)

As I followed cheesegrits's guide of this post:
http://fabrikar.com/forums/index.php?threads/how-to-initially-show-repeat-group.32911/#post-170456

I firstly updated form.js file (media > com_fabrik > js folder)
I also copied and pasted below code to form_x.js file (component > com_fabrik > js)

Code:
Fabrik.addEvent('fabrik.form.group.duplicate.min', function (form) {
    // insert code here to get repeat count from the server
    // with an AJAX call, and set this var.  For this example
    // just setting it to 3 as a test.
    var rcount = 3;
 
    // You'll need to know your numeric group ID as well,
    // so you can override the repeat min setting in the form object
    form.options.minRepeat[123] = rcount;
});

Of course I have changed [123] into my group ID number for just testing, however nothing happened :(
Even I just put 'alert('');' for checking if the function is working but it didn't work...(cry)

I have a question, I presume that this 'duplicateGroupsToMin' function has just created recently so I am not sure
if it really works...

There is not much information regarding to 'fabrik.form.group.duplicate.min' event in the forum and
event lists(http://fabrikar.com/forums/index.php?wiki/form-javascript/)... when this event triggers?

Do I need to set something in backend panel for repeat group?


Please help me cheesegrits, rob and hugh :)
Thank you in advance!
 
Hi

I'm fairly confused as to what it is you need to do.
I don't see what the repeat group js has to do with populating fields via an ajax call?
Can you:

* post the url to your form
* post the js code you are using
* Try to re-summarize exactly what it is you need to do.
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top