Welcome, Guest
Username: Password: Remember me

TOPIC: Subform??

Subform?? 03 Jul 2013 04:35 #7813

  • dniezby
  • dniezby's Avatar
  • Offline
  • New Member
  • Posts: 8
  • Thank you received: 1
  • Karma: 0
Is it possible to design a form that has one table up top and the grid on the bottom? For example. I have a games table that gives me the basic set up of the event. Then all of the player finishing positions in the bottom GRID. Like a leaderboard. They would all be part of the same event so rather than having to select an event with each entry, just tie them to that event?

Did I just loose everyone?

Any help would be appreciated.
The administrator has disabled public write access.

Subform?? 03 Jul 2013 22:22 #7834

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
What design do you use for your table in cook ? Is the EVENT and the RESULTS for that event in the same table ?
Hope i'm not lost ;-)
The administrator has disabled public write access.

Subform?? 06 Jul 2013 04:22 #7889

  • dniezby
  • dniezby's Avatar
  • Offline
  • New Member
  • Posts: 8
  • Thank you received: 1
  • Karma: 0
No. The events details are in one table while the results of that event (many results for one event) are in another table.

I don't want a user to have to select an event with EVERY result they put in. So for example. If a user selects an Event. A full form would open where the event details like the Date of the event, description, location etc would available. Then below, maybe in a grid, would be where all of the results from that event would be listed. Visually, I would say, to think of an Invoice. All of the main details up top and all the items for that one invoice below.
Last Edit: 06 Jul 2013 04:23 by dniezby. Reason: typo...
The administrator has disabled public write access.

Subform?? 07 Jul 2013 10:21 #7899

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
In this case do not think the way 'merging' 2 layouts.

Learn the view part and template and realize it from scratch.
- view.html.php is loading the php objects
- template file is showing the html rendering.

Choose a layout and empty it.
Base this layout on the 'Invoice' item layout in your example.
Then, the view file will load the invoice in $this->item, but you are not limited, you can fill new vars and send them to the layout.
When you want to do a PDF or an export, it is the same. You prepare the datas first in the view file.

In the view, you can load whatever models you want (see how the FK are loaded in forms)
Just understands how the model works (loading datas), and how JDom works (rendering the datas)
That's easy.

Even better, you can create N:M (in the model)
It means that Invoice will contain an array objects containing the sub items.
Place the code in populateObjects() of the model, and execute it only if the model has received a state value for that.
This is the really short description of the N:m tutorial.

Hope it helps.
And remember alway to write in the 'fork' files.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.094 seconds

Get Started