edit form with selector and toolbar

esposito84 04 May, 2016
Hello, sorry for my english.
I created a form and i include the toolbar and selector in CC5. This iis the code:
$url2 = JURI::root().'index.php?option=com_chronoconnectivity5&cont=lists&ccname=clienti&act=edit&gcb={gestione_clienti.id}';
echo $this->view->Toolbar->addButton("toolbar-modifica", $url2, "MODIFICA", $url3, "submit_selectors",l_('SELECTION_REQUIRED')); 

Well, this work fine, but now the gcb is an array. i tried to put in the update condition of db save action (of cFv5) a condition
return array('id' => $form->data['gcb'][0] );
and i tried also
return array('id' => $form->data['gcb'] );
but when i go to change value the form doesn't work. redirect me on the CC5 but doesn't change the value.
Anyone know how can do it?
thank advanced
GreyHead 05 May, 2016
Hi esposito84,

You can’t usually pass an array in a URL - what exactly is the URL you see on the ChronoForms page?

Bob
esposito84 05 May, 2016
hi Bob thank a lot for your attemption. i sent you the first part of debugger and the url
GreyHead 06 May, 2016
Hi esposito84,

If you look at the URL at the top of the image you will see that the record id is not being passed correctly.

Bob
esposito84 06 May, 2016
thanks,
the debagger show a gcb as array and the value is correct. I can't to change url gcb becouse chronoform see $gcb as array and i can't use array. How Can I do?
GreyHead 06 May, 2016
Hi esposito84,

The URL doesn't show any value - it looks to me as if you have {gestione_clienti.id} in there. Looking at your code you have
$url2 = JURI::root().'index.php?option=com_chronoconnectivity5&cont=lists&ccname=clienti&act=edit&gcb={gestione_clienti.id}';
echo $this->view->Toolbar->addButton("toolbar-modifica", $url2, "MODIFICA", $url3, "submit_selectors",l_('SELECTION_REQUIRED')); 
You can't use {gestione_clienti.id} in PHP like this. Does this work:
$url2 = JURI::root().'index.php?option=com_chronoconnectivity5&cont=lists&ccname=clienti&act=edit&gcb={$row['gestione_clienti']['id']}';
echo $this->view->Toolbar->addButton("toolbar-modifica", $url2, "MODIFICA", $url3, "submit_selectors",l_('SELECTION_REQUIRED')); 

Bob
esposito84 06 May, 2016
Thanks Bob,
now work fine but it doesn't save a modify. i try to find a reason else use a sql update for update data. but it is very fast for me to try to use a db save (becouse i have too much data in my 100 form)
GreyHead 06 May, 2016
Answer
Hi esposito84,

You can try using a DB Save in the form and adding a Debugger to see the query that is being created. That might show up any problems with the query.

Bob
esposito84 07 May, 2016
Thank you so much Bob,
my mistake was that i put the php code in the header, but now i use a custom chronoconnectivity and i put the php code in the Body and it work fine.
thank you so much.
This topic is locked and no more replies can be posted.