Buy Now
Sign in

DBRead - How does it work? (still no clue …)

burf , December 07 2018, 12:27
B
burf 112
December 07 2018, 12:27 #382051
Hi,
though reading through the forum I still don't get it … How does the DBRead function work with my simple form?
What I plan: A simple form with 20 dates over the year where users can check a certain date in order to make an appointment with me.
What has been done:
  1. Designer: Form with two Checkboxes, Label "January 11" (field name "Datum1") and Label "January 12" (field name "Datum2"), with "options" "Yes" and "No", and a submit button to my table.
  2. Setup: On load (Load Java, Load CSS, DB Read, HTML Render), on submit (Handle Arrays, DB Save, Display Message)
  3. DB Read options are: active, Table name, multiple read YES, ModelL-ID active YES, ModelL-ID "Data"
When I test the form, I can check the boxes and the entries are saved in the table. However, when I open the form again, no box is selected, which means, that the "read" did not work.
What do I have to do? – Thanks for your help!
Carsten
healyhatman 7
December 07 2018, 21:01 #382059
If you're creating a brand new form, why wouldn't you make it in the newer and much easier CF6 ?
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
B
burf 112
December 10 2018, 09:54 #382085
Thanks for the hint. I installed v6, with no success in creating the new form.
The "debugger" action says that the form reads the data from the table correctly, but the respective check boxes are not checked/unchecked accordingly.
Attached are three images: the designer section and the setup-load and setup-submit section. What will I need to change in order to have the respective checkboxes checked or unchecked when the form is opened? (The checkbox shall be checked if it has been checked by any user.)
Any help? Thanks a lot.

Carsten

setup_submit.pngsetup_load.pngdesigner.png
Attachments
designer.png
designer.png
(408.93 KiB)
225 Downloads/Views
setup_load.png
setup_load.png
(356.81 KiB)
225 Downloads/Views
setup_submit.png
setup_submit.png
(294.74 KiB)
226 Downloads/Views
healyhatman 7
December 10 2018, 10:56 #382086
OK so first thing - you have your data read set to All Matching. Set it to First Matching.
Secondly, it hasn't checked the checkbox because you haven't told it to. Go to the Advanced tab of the checkbox. Under "Checked status provider" you'll need to put in
{var:read_data4.modelname.fieldname}
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
B
burf 112
December 10 2018, 12:34 #382109
1) Thanks. That was it! Would never have found this solution …
2) At the "Events" tab of the checkbox I can add "actions". I would like to add that the checkbox is "checked" & "disabled"=faded out, if the last matching record says "checked".
However, if I add "on check" a "disabled" action, it will not save the status "checked". And if I add "hide", it will immediately "hide" the checkbox, and don't show again.
healyhatman 7
December 10 2018, 12:35 #382112
An input that is disabled is not sent when the form is submitted - this is standard HTML behaviour.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
B
burf 112
December 10 2018, 12:41 #382113
so there is no (easy) way to have an already checked checkbox read and show, but faded out like in this image?
Bildschirmfoto_2018-12-10_um_13.39.24.png
Attachments
Bildschirmfoto_2018-12-10_um_13.39.24.png
Bildschirmfoto_2018-12-10_um_13.39.24.png
(13.24 KiB)
213 Downloads/Views
GreyHead 64
December 11 2018, 10:11 #382148
Hi burf,
Have you tried setting the checkbox to readonly instead of disabled? You may need to use Custom CSS to do that.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
B
burf 112
December 11 2018, 12:25 #382154
Hi Bob,
since I am not at all an expert in Custom CSS, I'll probably have to find another way … CF6 is nice and big tool, but some things are getting too complicated for amateurs like me. (The rule for the checkbox would be "set checkbox to readonly if any record says "checked"".)
Thanks, Carsten
healyhatman 7
December 11 2018, 12:33 #382155
Why did it need to be sent in the form data anyway? What's wrong with just disabling it?
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
B
burf 112
December 11 2018, 13:15 #382156
Thanks for your reply.
I have a list of lets say ten dates, reserved for consulting employees of a certain company. They now have to book a certain date, and only one person shall be able to book one certain date. When it is booked, nobody else should be able to book that same date.
If I "disable" the item, no one will be able to book that certain date, not even the first to come, since it will just do nothing.
If I "hide" the item, it will immediately disappear, and cannot be undone by the person who might only accidentally checked it.
Any unchecked item should be able to be checked once, and only once, and afterwards it should be faded out or at least completely hidden.
Carsten
GreyHead 64
December 11 2018, 14:49 #382158
Hi Carsten,
Only one person will be submitting the form form themselves if I understand correctly. If they are only allowed to select one date then use radio buttons instead of checkboxes. Once they submit the form you can mark that data as 'taken' and remove it or disable it from the radio button set for later users.
Technically it is possible that a second form gets submitted for the same data before the first user has completed and submitted their form - if you think that this is possible then you should add a server-side check to confirm that the selected date is still available,
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
B
burf 112
December 11 2018, 15:41 #382160
Hi Bob,
thanks. It really seems to me, that all of this would be possible – but that for me it is to complicated. Never mind, I will still use CF for other questionnaires.
Testing with radio buttons I now again have the same DBRead problem as above, that the information is not read when opening the form again (the "Checked status provider"-field is missing). – Not mentioning, that I would need to add a server-side check as written above …

And finally it also depends on my question #382145 from earlier today. If it is getting more difficult I might stay with CF5.
Thank you very much.
Carsten