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

TOPIC:

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

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!

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

Last edit: by soportedo.

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

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

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

Last edit: by BTB300.

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

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

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

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

Soportedo,
I didnt forget ;) i just have not been able to find an answer
The following user(s) said Thank You: soportedo

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

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

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

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

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started