Welcome, Guest
Username: Password: Remember me

TOPIC: HOW TO record several item at once

HOW TO record several item at once 23 Aug 2015 19:07 #13405

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
With Cook's new dev, is it now possible or easier to get to add several items at once. Say i want to insert name, surname and a job (coming from a fk combo) at once, without having to save&new at each person ?
Thanks,
V.
The administrator has disabled public write access.

HOW TO record several item at once 24 Aug 2015 19:52 #13409

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
The new dev didn't added any feature at the moment.
The coming stuff is FOF.

I just posted some informations here :
www.j-cook.pro/index.php/forum/14-news-c...ews-what-is-going-on
Coding is now a piece of cake
The administrator has disabled public write access.

HOW TO record several item at once 24 Aug 2015 20:10 #13411

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Still, as we had this conversation before, do you see any solution or at least leads to get it done ?
Thanks,
V.
The administrator has disabled public write access.

HOW TO record several item at once 24 Aug 2015 20:16 #13412

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Yes it is possible.
You will use arrays of inputs. The inputs of the grid will be named : myinput[1], myInput[2].. and so...
When the controller receive the arrays of datas, then at that moment you split in parts and repeat a creation statement with the model.
Very simple.
Then if you want to make it proper you will maybe need a management of the errors.

For my opinion, the best is AJAX/javascript, but much work until we don't dispose of a proper JS framework layer.
After FOF, (and after N:M), I would like to open the road for Angular JS integrated in component.
Coding is now a piece of cake
The administrator has disabled public write access.

HOW TO record several item at once 24 Aug 2015 20:19 #13414

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
That's what i had in mind, but i got stuck with cascading combos. Something to do with instances i guess, but it's beyond my knowledge i guess
The administrator has disabled public write access.

HOW TO record several item at once 24 Aug 2015 20:29 #13416

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Oh yes, if you use the ajax combos, then to change the name it is little bit more struggle.


In the views witch renders the combos, you must define new 'render' context for every combo. (example : city/country/continent) in every different views.
You will have to copy a lot of code, but this is necessary because it is complex stuff.
Those combos are prepared to receive and array of values and catch the good one, when it must auto load the selected item. ... a pain.
So just copy code in a the new 'render' context (from a similar ajax combo else where)

Then, #2, define the names of the input with array group. You do not need to implement the auto-selection part, because it is only for 'creating'.
Just rememeber in case of ajax combos that only the last combo is important to name in arrays. Others are only filters and we don't care the value.
EDIT : So you don't need to name in arrays the filters. Only the last one, but you have to identificate the ID with prefix for all combos as well if you want to avoid collisions of JS/AJAX
Only the last one is relevant. (With a simple FK research, the parent items are related)
I think you can make it no problem.
Good luck.
(... and thanks to JDom it is little bit more easy because you avoid all this HTML in the view file by the way.)
Coding is now a piece of cake
Last Edit: 24 Aug 2015 20:36 by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: VeCrea

HOW TO record several item at once 24 Aug 2015 20:31 #13418

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
I think i need chocolate...
Thanks hun,
V.
The administrator has disabled public write access.

HOW TO record several item at once 24 Aug 2015 20:37 #13420

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Edited...
Have a good chocolate. I think I will do the same.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.067 seconds

Get Started