Forums

Manipulate/change data after form submission prior to save

gotpowr 16 Aug, 2024

I'm looking to manipulate data after form submission and prior to save based on conditions.

I have a form (start_page) with entry fields where the user submits and it goes to "end_page" with a data save

Before that data save, I want to run a check and update data.

Basically something like the following:

"if Driver = 0 (no) then set Car Number to NULL, Car Class to NULL"

and if Driver = 1, leave the fields as they were submitted.

Is there an easy way to do this?

Max_admin 17 Aug, 2024

Yes, you need to use a PHP action with conditions (Events), and setup the Drive check condition

Why not use version 8 for this ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gotpowr 20 Aug, 2024

So really dumb question, would I use standard PHP logic and put it on the end page to get triggered before save? I'm using a similar format to the articles demo form [or at least converting to it as I'm working on an edit option].

I just came off v4 and was picking up v7. I looked at V8 but felt there were a few things not yet in there from v7. Also not gonna lie I'm hoping you might add import functionality for V8 from v7 lol.

gotpowr 10 Sep, 2024
Answer

So I found an alternate way and wanted to post.

I added a "variables" section at the end page of the form prior to the save action.

I put a "run conditions" on it to only run if "Driver = 0"

In the details, I added "Request"  "model.CarNumber" "{const:null}"

"Request"  "model.CarClass" "{const:null}"

Seems to work perfect!

Max_admin 11 Sep, 2024

Apologies for the delay but I'm glad you got it working

using v8 is still recommended, the interface and workflow are better, you can mix actions and views in v8 but not v7, this gives you more control, and missing features are supposed to be added, I can give priority to critical features if you have any

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gotpowr 12 Sep, 2024

Hi Max,

I'd love to try switching to V8 - are there any plans to be able to import V7 forms like you can with the V6?  If so, that would be incredibly helpful, not only in not having to recreate a bunch of forms, but also in providing references for how to do stuff in V8.

Max_admin 14 Sep, 2024

because the forms data structure and behaviors are different, an import would only rebuild the fields and actions without any advanced features, for example a Save/Read data action would just be imported with the table name selected, other settings will not be imported because they are different, do you think this would be helpful for you ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gotpowr 16 Sep, 2024

Hi Max,

Yes it would be helpful to have the structure at least there, even if the options couldn't be brought over.

At least then the general setup of the form (fields, order, etc) is there to then change the options.

Thanks!

gotpowr 18 Sep, 2024

Also, just playing around with recreating a simple form - CF8 seems to be missing an export to csv action.

You need to login to be able to post a reply.