Welcome, Guest
Username: Password: Remember me

TOPIC: Foreign key problem on form

Foreign key problem on form 23 Aug 2012 22:54 #3273

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
I have a strange problem.
I have created a table structure like this:


When I go to pages and add Keyword and Sub keyword to my collection, it works as expected:


But when I try to add the exact same field to my item page I get this:


Also Item page wont let me add both Keyword and Sub keyword, but only one of them, while collection page has no problem. I find this behavior rather strange. I'm I missing something?
Last Edit: 23 Aug 2012 22:56 by dyvel.
The administrator has disabled public write access.

Foreign key problem on form 24 Aug 2012 08:04 #3280

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Seems you dragged the Table ID, not the sub level field.
Can you confirm that in your fly you dropped you 'Keyword' field, behind the Keyword table ?
I mean, even if it is 2 or 3 levels deep, try to drop the last field, not the Table node.

Is there a real issue for you ?
Coding is now a piece of cake
The administrator has disabled public write access.

Foreign key problem on form 24 Aug 2012 08:09 #3281

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
I dragged the same keyword


And currently it's in issue yes, as it means I cannot do what I would like it to do :S
I don't understand why it's no problem in the collection, but only on the item page... ???
Last Edit: 24 Aug 2012 08:13 by dyvel.
The administrator has disabled public write access.

Foreign key problem on form 24 Aug 2012 08:11 #3282

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
But that said, I must also say I'm VERY IMPRESSED with Cook - it's really powerful and I can't wait to see version 2.0
The administrator has disabled public write access.

Foreign key problem on form 10 Sep 2012 18:10 #3486

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
I still have this problem in V2.0 :(
The administrator has disabled public write access.

Foreign key problem on form 10 Sep 2012 21:52 #3495

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
It is not an issue.

You are in a form.

Let me explain you why the form do not accept sub levels keys :

When submit a form, the datas are stored in a table row. Simple to understand.
This row is identified with a number (id or cid) sent to identifiate the item. can be 0 when you create it.

What happen if you have a category for example ?
A category field if used to link (FK) to a category item. This is a foreing key in a form. It works.

But what happens if you attempt to modify in the same form, the label of the category ?
It will modify this category label, used by others items.

It is not structurally correct. You can never do that.
If you have a 1:1 link, you can do that because you are sure that the second level field will never be used by another item. So you can have a single form that treats datas on two different tables (or more), but as I said before, only with 1:1 links.

So, now what ?
Cook do not handle 1:1 links, neither N:1, or N:N
The road is long, but I am sure you will face a very nice case of study to start understanding your component.
Coding is now a piece of cake
The administrator has disabled public write access.

Foreign key problem on form 10 Sep 2012 21:59 #3496

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I'd like to add ...

When you'll be initiated in the source code and understand the new structure, you will be amazed how fast you can develop.

Every time you understand a little bit more your component, every time it becomes easier for the future.

Joomla is the future. The version 3.0 is really good and seems to become really professional.
Learn this 2.0 structure of your component because it is very close to the long term structure. Joomla 3.0 didn't changed that much for the point of view of the MVC structure.

You can fly on this technology for at least 5 years without problem. Joomla is sooo good.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.073 seconds

Get Started