Hi,
Some data in my form is already prefilled from a database, using DB read.
I also use a 'show/hide parent' event on some fields. So only when a certain option is chosen another field is show (or hidden).
How can I delete the data of a hidden parent field in the db?
for example: in the form someone can choose between "work" or "at home". If they choose "work" then there is another choice: "early shift" or "late shift". If they choose "at home" there is no other choice. So if that someone choses "work" and "early shift", this data is written in the db. But when (for example) the same person wants to alter its worksituation to "at home" (and it is written in de db) also "early shift" has to be reased from the db.
Does anybody know how to do this?
Bart
Some data in my form is already prefilled from a database, using DB read.
I also use a 'show/hide parent' event on some fields. So only when a certain option is chosen another field is show (or hidden).
How can I delete the data of a hidden parent field in the db?
for example: in the form someone can choose between "work" or "at home". If they choose "work" then there is another choice: "early shift" or "late shift". If they choose "at home" there is no other choice. So if that someone choses "work" and "early shift", this data is written in the db. But when (for example) the same person wants to alter its worksituation to "at home" (and it is written in de db) also "early shift" has to be reased from the db.
Does anybody know how to do this?
Bart
Hello thewelt,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How to load record data from a database table into your form
My form data isn't saving to the database correctly
My CFv5 form data isn't saving to the database correctly
How do I save form data to a database table?
How can I edit a record from a database table?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How to load record data from a database table into your form
My form data isn't saving to the database correctly
My CFv5 form data isn't saving to the database correctly
How do I save form data to a database table?
How can I edit a record from a database table?
P.S: I'm just an automated service😉
HI Bart,
The simplest way to do this is probably to add a Custom Code action in the On Submit event before the DB Save action to check the submitted date. The code will be something like this:
Bob
The simplest way to do this is probably to add a Custom Code action in the On Submit event before the DB Save action to check the submitted date. The code will be something like this:
<?php
if ( empty($form->data['work']) ) {
$form->data['early_shift'] = '';
$form->data['late_shift'] = '';
}
?>
Bob
Thanks Bob,
In fact my form has several "choices". For example:
a person can choose between (werkstatus) "werkloos", "deeltijds", "voltijds".
If the choose "werkloos" another item is shown and people can choose between "wil werk" and "wil geen werk". Al other DB-fields has to be deleted.
If they choose "deeltijds" then they get another a question "hoeveel uur werk u?" and also "wil u meer werk?" Then al other DB-fields need to be deleted.
If they choose "voltijds" then they get a question: "wanneer ben u terug beschikbaar?" and all other fieds need to be erased.
Is this possible using a code or another option?
tnx Bart
In fact my form has several "choices". For example:
a person can choose between (werkstatus) "werkloos", "deeltijds", "voltijds".
If the choose "werkloos" another item is shown and people can choose between "wil werk" and "wil geen werk". Al other DB-fields has to be deleted.
If they choose "deeltijds" then they get another a question "hoeveel uur werk u?" and also "wil u meer werk?" Then al other DB-fields need to be deleted.
If they choose "voltijds" then they get a question: "wanneer ben u terug beschikbaar?" and all other fieds need to be erased.
Is this possible using a code or another option?
tnx Bart
Hi Bart,
You can use code similar to the example I posted. That is probably the simplest and most reliable solution.
You might be able to add JavaScript to remove any values from hidden elements. That will work if the elements are just hidden - it will fail if they are disabled as they will not be submitted with the other form data.
Bob
You can use code similar to the example I posted. That is probably the simplest and most reliable solution.
You might be able to add JavaScript to remove any values from hidden elements. That will work if the elements are just hidden - it will fail if they are disabled as they will not be submitted with the other form data.
Bob
This topic is locked and no more replies can be posted.