Welcome, Guest
Username: Password: Remember me

TOPIC: [HELP HOWTO] form for a specific record in V2 (1:1)

[HELP HOWTO] form for a specific record in V2 (1:1) 16 Nov 2012 20:07 #5432

  • gdpodesta
  • gdpodesta's Avatar
  • Offline
  • Senior Member
  • Posts: 75
  • Thank you received: 8
  • Karma: -42
I've been trying to understand this at this post: www.j-cook.pro/forum/9-coding-inside-you...or-a-specific-record

It refers to how easy it is in V2, but doesn't explain how to do it in V2. As this example talks about, I want to display an edit form for the user where it's primary key is equal to $user->id instead of the value specified in the menu item for the component.

How can this be done in V2?
The administrator has disabled public write access.

Re: [HELP HOWTO] form for a specific record in V2 20 Nov 2012 21:43 #5521

  • gdpodesta
  • gdpodesta's Avatar
  • Offline
  • Senior Member
  • Posts: 75
  • Thank you received: 8
  • Karma: -42
Found the answer for my implementation:

In protected function displayLicenseemaintenance (where I'm loading the form), I did this. In my component, the table "license" will always have an id equal to the current user_id, so I adjusted the state as follows:
protected function displayLicenseemaintenance
...
$this->model	= $model	= $this->getModel();
$this->state	= $state	= $this->get('State');
$this->state->{'licensee.id'} = $user->id;
It doesn't strike me as the "right" way of doing it, but it works :unsure:
The administrator has disabled public write access.
The following user(s) said Thank You: admin
Time to create page: 0.091 seconds

Get Started