Forums

Update list with CF

FloB 22 Apr, 2016
Hello,

I have a connection and I want to use direct edtiting for some fields edting.
I have followed the FAQ and it's working but the redirection after the save doesn't fit with my use.
I want to be redirected where another url. I have understood, reading some posts that I can't redirect with the default toolbar_savelist. Seems I need some chronoform action.

But I don't understand how I could do this.
Do I need to create a button with this code :
 $this->view->Toolbar->renderButton("button_id", "link_href", "TEXT", "image_path", "submit_selectors");

How to fill the different parameters ?
Does it need to be placed in the header code between php tags?

Florence
GreyHead 22 Apr, 2016
Hi Florence,

The simplest way may be to use a standard CC Edit link to open the form, but then add your own DB Save and Redirect in the form On Submit ection (instead of using the CC action).

Bob
FloB 22 Apr, 2016
Hi Bob,

If I understand right, the CC Edit link is obtained with _EDIT_ in a field. So I would have an Edit link for each rows.
Can I have access to the whole connection data with this edit link, because I want to update all the selected box?

Thanks
Florence
GreyHead 22 Apr, 2016
Hi Florence?

How do you see that working - one form with multiple rows? If you want to edit a lot of rows I think that you can do that by making the listing editable. Please see this FAQ

Bob
FloB 22 Apr, 2016
Hi Bob,

It's the FAQ I have with my form but I want to be redirected where a specific url after the update (not the one with the "?cont=lists&act=index&ccname=CC_name").

Is there a way to do that?

Thanks
Florence
GreyHead 22 Apr, 2016
Hi Florence,

Sorry I have no idea :-(

Bob
FloB 22 Apr, 2016
Hi Bob,

I will try to create a button with the renderButton thing.

Flo
FloB 22 Apr, 2016
Hi Bob,

My connection name is "ListePhotosSortie". I have added a "New" button with the _TOOLBAR_NEW_ and I have created a form "SauvegardeModifsPhotos" with an event named "new". On the connection, in frontlist action, for the edit one, I have put "SauvegardeModifsPhotos:new" in the form event.
If I click on the "New" button, I am redirect to the event "new" of the "SauvegardeModifsPhotos" form I have created and the url looks like : http://site_url/menu_path?cont=lists&act=edit&ccname=ListePhotosSortie
So this "New" button (from _TOOLBAR_NEW_) is working well.

I have tried to add a renderButton linked to a "sauvegarde" action:
Put this code in the header code :
<?php
echo $this->view->Toolbar->renderButton('save_list2', r_('menu_path&cont=lists&act=sauvegarde&ccname='.$connection['Connection']['title']), l_('UPDATE_LIST'), $this->view->Assets->image('save_list', 'toolbar/'), 'submit_selectors', l_('SELECTION_REQUIRED'));
?>

I have created a new action for the frontend list named "sauvegarde" and I have added "SauvegardeModifsPhotos:save" in the form event.
I have created an event "save" in my "SauvegardeModifsPhotos" form.
If I click on this button, I'm redirected to a page with that url : http://site_url/menu_path&cont=lists&act=sauvegarde&ccname=ListePhotosSortie
So the url looks correct to me but it's a 404 error page.

Do you have any idea?
Thanks

Florence
FloB 22 Apr, 2016
Answer
1 Likes
Sorry, just find an error on the url :
menu_path&cont=lists&act=sauvegarde&ccname='.$connection['Connection']['title']
to
menu_path?cont=lists&act=sauvegarde&ccname='.$connection['Connection']['title']

So I think I can handle it and make the save and redirect to the url I want :-)

Florence
This topic is locked and no more replies can be posted.