Hello, have a question - stuck with the following dilemma:
HOW to use one form and one Event for two actions - add new record and edit existing record?
I can either add new or edit existing record😟
My steps so far:
1) Created {fn:read_submission} with condition Submission.aid={data:aid}
2) created CF6 form with
4) created link that edits existing record - submission_edit_link with Event "edit"; URL and/or URL parameters - aid={var:submissions_list.row.Submission.aid}
5) created edit event with
7) created save event with
And result is as follows:
1. when I put Update condition Submission.aid={data:aid} Edit record works/ Save new record - does not;
2. If I delete that Update condition, I am able to save New record and get duplicated record on edit;
What have I missed here?
Thank you in advance-
Elita
HOW to use one form and one Event for two actions - add new record and edit existing record?
I can either add new or edit existing record😟
My steps so far:
1) Created {fn:read_submission} with condition Submission.aid={data:aid}
2) created CF6 form with
- Hidden field - aid
- defined field names so all they have one Model - Submission[Name];
- added field Value - {var:read_submission.Submission.Name}
4) created link that edits existing record - submission_edit_link with Event "edit"; URL and/or URL parameters - aid={var:submissions_list.row.Submission.aid}
5) created edit event with
- {fn:read_submission}
- {view:submission_form} - this call CF6 with {chronoform/section:juridiskas-labot/load} and save Toolbar button [ step 8) ]
7) created save event with
- {fn:save_submission}
- {redirect:index}
And result is as follows:
1. when I put Update condition Submission.aid={data:aid} Edit record works/ Save new record - does not;
2. If I delete that Update condition, I am able to save New record and get duplicated record on edit;
What have I missed here?
Thank you in advance-
Elita
Figured out - hidden field in CF6 form should be Submission[aid].
So, all the written above could be used to create add/edit functions to your existing table.
Have a great day -
Elita
So, all the written above could be used to create add/edit functions to your existing table.
Have a great day -
Elita
Or you could (and should, really) just have two events.
that was my first thought, healyhatman, but then, by analyzing Demo form Max created I noticed he used only one form. I am lazy by the nature - so tried to follow his approach😀
One FORM is fine, sorry I thought you meant one EVENT
.... and one event. too.
I use one Save event and one form for both actions - Add new and Edit existing - you can achieve that by adding Model to the field - that I "dug out" of the Demo form Max creatded - add Model[field name] and then on save use that Model as Data provider. Very convenient.
I use one Save event and one form for both actions - Add new and Edit existing - you can achieve that by adding Model to the field - that I "dug out" of the Demo form Max creatded - add Model[field name] and then on save use that Model as Data provider. Very convenient.
This topic is locked and no more replies can be posted.