Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

NewBie problem - cant get Foreign Key lookup to wo 06 Feb 2014 18:30 #12142

  • mtifinn
  • mtifinn's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 20
  • Thank you received: 2
I am a newbie to jCook and cannot figure out how to get the Combo box in a form to populate from a foreign key. I have created two tables, and created a foreign key field in 1 of them and linked to the other table.

I have created the views but all I get in the combo (select) box when editing is a single line - which defaults to 0.

Bizarrely if I enter a value into the combo box (a select box) I can get the correct foreign table values - so the tables are linked- but I can't seem to get the foreign key ids to appear so I can select ... and in any case I should not be able to type a value in a combo box?


Update - I just realised that the field in the form is a text field (which explains why I can type in it) and yet I have specified Combo Box. Any Ideas why it renders the wrong field type?

Later ...

Solved it. Deleted all the fields and redid everything and now it works .. ;)

Please Log in or Create an account to join the conversation.

Last edit: by mtifinn. Reason: Solved

NewBie problem - cant get Foreign Key lookup to wo 06 Feb 2014 21:59 #12143

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
@mtifinn,

Glad you got it sorted!

For future reference and to avoid having to start over:
When you add your FK fields to layouts, ensure that you select and drag a child-node/element of the field to the layout and not the parent node/element.
Example: Basic Book Library
1. Create the following tables & fields:
1.1 Table 1: 'authors'
1.2 Table 1 Fields: 'id' (cook auto-created), 'name'
1.3 Table 2: 'books'
1.4 Table 2 Fields:
2. Create a new admin item layout for authors & drag the 'name' field to the layout
3. Create a new admin item layout for books & drag the 'title' field to the layout.
4. Click the + symbol of the 'author_id' field
5. Drag the 'name' (i.e. the author's name or authors.name) node to the layout NOT the 'author_id' node

I hope this helps in your future endeavours!

Best wishes,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The following user(s) said Thank You: admin, mtifinn

Please Log in or Create an account to join the conversation.

Last edit: by JoomGuy.

NewBie problem - cant get Foreign Key lookup to wo 06 Feb 2014 22:02 #12144

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
***ADD
Naturally, the same principle applies to displaying data in grid/list views too.
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.063 seconds

This is what you call a component builder. I was able to master using this in a very short time and the resulting component works like a charm. Not just a basic component builder but a fully working component builder with forms fields tables all ready to go. You can make the list and item views to display in the front and back end. Also there is a great forum just starting to evolve and I'm sure this will grow very rapidly when you all realise how good this tool is.
Kevin (JED)

         

Get Started