CC6 Edit row of a table in a popup

gix.vax 25 Feb, 2023
Hi all

I need to edit data in popup without opening other pages
I have a button that works but have some strange behaviou


I have a task button : paga_button
no event
no url
no dynamic ajax feautures
open popup yes
content of popup : {view:form_paga}

the view that appear in popup
{view:form_paga}
(no submit event, no data provider and submit ajax no or yes give the same result)
FIELDS:
{view:idbollettino_pag} :
TEXT FIELD content
value {var:bollett_list.row.bollett.id}|{data:idbollettino_pag} )
{view:set_data_pag}
CALENDAR
value {date:}
{view:paga_conferma_task}
TASK BUTTON
event : salva_pagamento_singolo (save record and redirect index)
Dynamic ajax feauture YES
Dynamic task send:#form_paga (however i try send/closest:.ui.form too)
Dynamic result : replace/closest:.ui.form
Custom static Task no

i can open popup with my id and calendar and i can save record
but if i change data in calendar {view:set_data_pag} it save the default date {date:} and not the date changed


my debug

Array
(
    [cont] => manager
    [conn] => bollettini
    [search_cliente] => 1951
    [event] => salva_pagamento_singolo
    [idbollettino_pag] => 2476
    [tvout] => view
    [paga_conferma_task] => Array
        (
            [counter] => 0
        )

    [_counter] => 0
    [Itemid] => 113
    [option] => com_chronoconnectivity6
    [view] => connection
    [helix_id] => 9
)

Array
(
    [salva_pagamento_bollettino] => Array
        (
            [data] => Array
                (
                    [cont] => manager
                    [conn] => bollettini
                    [search_cliente] => 1951
                    [event] => salva_pagamento_singolo
                    [idbollettino_pag] => 2476
                    [tvout] => view
                    [paga_conferma_task] => Array
                        (
                            [counter] => 0
                        )

                    [_counter] => 0
                    [Itemid] => 113
                    [option] => com_chronoconnectivity6
                    [view] => connection
                    [helix_id] => 9
                    [pagato] => 1
                    [dt_pagato] => 2023-02-25 21:03:02
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => UPDATE `aaa_bollettini` AS `bollett` SET `pagato` = '1', `dt_pagato` = '2023-02-25 21:03:02' WHERE `id` = '2476';
                )

            [var] => Array
                (
                    [pagato] => 1
                    [dt_pagato] => 2023-02-25 21:03:02
                )

        )

)


I think i'm not ale to pass in data my date
Wich is the right way to edit in popup?
gix.vax 26 Feb, 2023
I solved:

my popup form:
form id : form_paga
data provider nothing
ajax submit: yes
invisible form: yes
keep alive no
no data provider
submit event : Submit (i don't have a an event called submit, i try with submit event emptyand it work)

popup form content:

{view:idbollettino_pag} (id form my table list)
{view:set_data_pag} (the date i want ot chenge and save)
{view:paga_conferma_task} (my task button that send my popup form)


my task button (the button that send my form)
event: save date
url: heare i pass all the data values i need for my table list (see redirect_index in the event below)
Dinamyca ajax features: yes
dynamica task : send/closest:.ui.form
dynamic result : replace/closest:.ui.form
custom staitc task: leave this field empty


event
{fn:save_date_to_db}: is a db save update . - Source is {data:} - {data:id] in WHERE (if null STOP) - [data:my_ date} as updaet value
{fn:redirect_index} : i don't call an (event:event_name} or event_name with parameters cause it have strange behaviour if you have filtered your table list. In my redirect i pass variable of filter previously selected fo my table list so i view the same record i have before i update with popup.

the 2 things changed in form against my first post are:
in the popup form:
ajax submit : yes
invisible form : yes
(my task button call as the FAQ says : dynamica task : send/closest:.ui.form dynamic result : replace/closest:.ui.form )

SOLVED
Elita- 13 Mar, 2023
Hi, could you, please, explain in details how you pass the filter parameters to the form submit?
and what is in the function of {fn:redirect_index} ?
Thank you.
gix.vax 13 Mar, 2023
hi Elitakey

- I have a table list view
every row have a TASK BUTTON that open a popup
(no parameter passed)

POPUP FORM
popup content : {view:myform}
(no parameter passed)

FORM VIEW
Ajax sumit: yes
invisible form. yes
event: submit (i think this is not necessary)
Action URL and/or parameters : empty

FILEDS IN FORM VIEW
my fields take data from list view with standard syntax {var:mylist_view:row.model.field}
eg.
field name : idboll
field value : {var:bollett_list.row.bollett.id}|{data:idboll}

SEND POPUP FORM DATA
In form i have a task button that send form data and the trick is configura task button in this way
Dynamic Ajax feautures : yes
dynamica task : send/closest:.ui.form
dynamic result : replace/closest:.ui.form

it sends data of the nearest ui form, the popup form in this case, itself!

REDIRECT
To refresh my table list view i recall index event and i use a redirect cause i need to send parameter
but you can call {event:index} or put parameter in {event:index$myparameters} if you like
You need to login to be able to post a reply.

VPS & Email Hosting 20% discount
hostinger