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

TOPIC:

About m to n relations - add button inside form 01 Feb 2013 14:24 #6606

Hi,

I have seen the "travel" tutorial and I'd like to ask an info.

As far as I understand the "many to many" third table is filled manually by means of a dedicated layout.
Would it be possible to insert the relation directly inside the traveler form, by means of an "Add"-"Delete" button ?

That is, let's say I have already filled my "City" table. I am now filling my "Traveler" table, and, while I am inserting the info related to one traveler (name, surname, ecc...) I would like to find a field "Has travelled to" where I can have a drop-down and choose a city, than by clicking "Add" a second drop-down should appear, and so on...
When I save, for each drop-down, a row in the table "Travels" should be created (id, traveler_id, city_id).

In this way, if an item has different many-to-many relations, these could be seen inside the same layout, without having to do the data entry inside dedicated layouts.

Can this be done (I mean, relatively easily) ?

Thanks for the assistance

Elena

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

Re: About m to n relations - add button inside form 01 Feb 2013 14:27 #6607

I forgot to add that, in this way, the "Travels" table could eventually be hidden (that is, it exists and is filled by data, but is not linked to any layout if this is not considered useful for the user).

Elena

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

Re: About m to n relations - add button inside form 01 Feb 2013 15:26 #6609

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi Elena and welcome to Cook!

What you propose is very much accomplishable with some post-cook coding.
  1. You could use jQuery (or another JS library if you like) to achieve the dynamic 'add'/'delete' tasks to your form - See this topic that goes through some jQuery in forms. It's not what you're trying to achieve but the same principle - using jQuery in forms: www.j-cook.pro/forum/35-jquery/4481-show...ds-in-front-end-form
  2. Call an instance of your second form into your 'Traveller' edit form and adapt - See link. Some things may differ - for instance, example is using JDom for form inputs instead of JForms - however, it should get you started: www.j-cook.pro/forum/9-coding-inside-you...les-in-one-view#1882


Hope it helps,

Gez
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.

Last edit: by JoomGuy.

Re: About m to n relations - add button inside form 03 Feb 2013 12:40 #6614

Thanks, I will try and let you know.

Sorry for the newbie question: once I download my job and start customizing it, am I supposed to go on outside Cook, or is there the chance of uploading my "cook-born" customized component to modify it (e.g. adding a table, a field, ecc...) while maintaining the modifications ?

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

Re: About m to n relations - add button inside form 03 Feb 2013 12:49 #6615

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

Sorry, there is no such mechanism for that and therefore, one must merge any cook changes into modified local projects. The best way is to use an IDE as most of them have a local file history that allow comparison between altered files, merging and so on.

Also, a lot can be said for hanging on until the very last moment to make any local customisations. That way, any 'core' changes you have to make to your component will be minimal.

There is a discussion about IDEs here that may be useful: www.j-cook.pro/forum/33-developper-resso...-for-php-development

Personally, and speaking as someone who is quite new to IDEs, I've found Aptana very useful indeed!

Hope it helps!

Gez
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.

Re: About m to n relations - add button inside form 03 Feb 2013 20:03 #6624

Thanks Gez,

I am downloading Aptana (nevere tried it before).

I will try to go as further as I can inside Cook, so to reach a "Cook last version" to customize outside.

Elena

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

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

Amazing Tool !
And only tool I know that allows complete Scaffolding in terms of component creation. It really saves loads of time (actually much more than that). Simple architecture enables quick and painless changes at any time. Code is clean and consintent. It's just... what's the word... neat! :) Great work! You should definetely try this one!

pi_wo (JED)
         

Get Started