Buy Now
Sign in

DB conditions

rtobias , April 24 2017, 16:19
R
rtobias 53
April 24 2017, 16:19 #367386
I'm sorry if this was asked already (looked and didn't see), but I just wanted to confirm:

In CF6, we can now write conditions (order fields, return fields, etc.) as either:
<?php return array("email"=>$form->data['email'], "id"=>$form->data['id']);?>


or (multiline list):
email
id

If this is indeed the case, awesome; being able to use either a multi-line list or a php array everywhere will be quite a bit easier.
Randy
admin 28
April 24 2017, 16:50 #367388
 Answer
Hi Randy,

Yes, this is correct, but the PHP format is a bit different:

<?php
return [["email", $this->data("email")], ["id", $this->data("id")]];


Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!
Did you try the new ChronoForms7 ? if yes then please send us your comments!!
R
rtobias 53
April 24 2017, 17:07 #367391
Thanks Max!

This is related: I didn't see a Handle Array action, but I did see a Modify Data action. I wasn't sure if that is what should be somehow used instead, or if the new DB actions didn't need special handling anymore. I know you've updated them a whole lot (I'm very impressed).
Randy
admin 28
April 24 2017, 18:24 #367394
 Answer
Hi Randy,

With the latest update you can convert any array values easily, lets say you have a checkboxes group called "checkboxes", by default you use {data:checkboxes}, but for array values you can get a comma separated list:

{data/join:checkboxes}

or json string:

{data/jsonen:checkboxes}

In the "Data override" box of the "Save data", you can add or modify fields values, so you could use the following to store a json string of the array values:

checkboxes:{data/jsonen:checkboxes}


Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!
Did you try the new ChronoForms7 ? if yes then please send us your comments!!
R
rtobias 53
April 24 2017, 18:25 #367395
 1
Very awesome. Thanks a ton!
Randy