Welcome, Guest
Username: Password: Remember me

TOPIC: problem with model and getFieldset

problem with model and getFieldset 27 Dec 2012 04:22 #6287

  • soportedo
  • soportedo's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Thank you received: 1
  • Karma: 1
I got this in a vew.html.php
I works OK, but I need to get from 52 and 52,53
I did it in a foreach but just brings the first (52) ...
$this->model	= $model	= $this->getModel();
		$this->state	= $state	= $this->get('State');
		$state->set('context', 'detalleoficio.adddetalleoficio');
		$state->set('detalleoficio.id', 52);
		$this->item		= $item		= $this->get('Item');
		$this->form		= $form		= $this->get('Form');
		 $fieldSet = $this->form->getFieldset('adddetalleoficio.form_1');
		 echo "<pre>**".print_r($fieldSet,true);

why I'm doing this?

Because I got a Edit form which needs to edit 3 records from a table.

Any Ideas or some pointing directions?

Thanks!
Last Edit: 27 Dec 2012 04:24 by soportedo.
The administrator has disabled public write access.

Re: problem with model and getFieldset 27 Dec 2012 07:10 #6288

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
a little confused here...
are you saying that there is 53 records in your database or are you saying that record 53 is a new record

-> foreach - can you post your foreach(...){ statement it might help to see what your trying to do
-> view.htmtl - are you working with a collection or item view

I know i had problems before with getFieldset from a collection view and did find that there was no definitions for collection view fieldsets infact there was no XML file in models/forms for collection layouts (obviously because no data entry required)

but i know all works fine in an item layout
Last Edit: 27 Dec 2012 07:12 by BTB300.
The administrator has disabled public write access.

Re: problem with model and getFieldset 27 Dec 2012 10:21 #6291

  • soportedo
  • soportedo's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Thank you received: 1
  • Karma: 1
this is the view.html.php
foreach($this->permisos as $i => $permi){    // $this->permisos has 3 array items
			$this->state	= $this->get('State');
			$state->set('context', 'detalleoficio.adddetalleoficio');
			$state->set('detalleoficio.id', $permi->id_detalle_oficio); // <-- here is te id (52,54,56)
			$this->model	= $this->getModel();
			$this->form		= $this->get('Form');
			$fieldSet = $this->form->getFieldset('adddetalleoficio.form_1');
			// echo "<pre>**".print_r($fieldSet,true);die;
			$obj2 = array("fieldSet" => $fieldSet);
			$this->permisos[$i] = (object) array_merge((array)$this->permisos[$i], (array)$obj2);
		}

And in the view I'm trying to reproduce the
$fieldSet = $this->form->getFieldset('adddetalleoficio.form_1');
with the $this->permisos permisos array

the problem is that $this->form->getFieldset('adddetalleoficio.form_1'); is stucked in the first id (52)

is it more clear?
thanks
The administrator has disabled public write access.

Re: problem with model and getFieldset 08 Jan 2013 19:54 #6376

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
Soportedo,
I didnt forget ;) i just have not been able to find an answer
The administrator has disabled public write access.
The following user(s) said Thank You: soportedo

Re: problem with model and getFieldset 25 Jan 2013 11:30 #6505

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
When you want to show multiple items, use a collection MCV.
If you want to show multiple forms in the same page, this is more complex. I never achieved this.
Use ajax, or play with the groups (JForms).

Your stuff is not easy to solve.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.065 seconds

Get Started