Forums

Make Form Read Only if a field is populated in the DB

spytech 25 May, 2020
Hi,

I have setup a form that does a read of the database on load. I need it to check a field on load to see if it contains data, if it does it should redirect to another page. How should I go about doing this?

Cheers.
Max_admin 25 May, 2020
there is an "if conditions" action, and in v7 there is a "Run Conditions" behavior to assign to a redirect action, but there is a bug in the redirect action at the latest v7 update!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
healyhatman 26 May, 2020
Don't even need if conditions in v6. Just do a read data, and in the "found" branch put the redirect.
spytech 30 May, 2020
Thanks healyhatman, thanks for that. I think I am close but its not working, can you see what I have below and let me know where I am going wrong. I want it to return the data for the {user_uuid} which it does, but when I add the extra condition for {radio35} it errors. I need it so if it finds the {user_uuid} + {radio35}=y then redirect, otherwise continue.
healyhatman 30 May, 2020
Well do you have a radio35 column in your database? Or are you looking to check the value of a field called radio35?
spytech 30 May, 2020
Hi, yes I have a column in my DB called radio35. If it has Y in it then it means the user has already filled in the form, so I want it to redirect to another page. If any other value in that field including NULL, it should continue to load the form.
healyhatman 30 May, 2020
Well you say there was an error but what error
spytech 30 May, 2020
So, I have tried the below option. It works if there is a Y in the column it redirects, but if there is not it does go to the form but it does not prepopulate the data:
healyhatman 30 May, 2020
Well of course not. You're asking it to get ONLY the data where the uuid matches AND radio35 is Y.
spytech 30 May, 2020
So do I need 2 seperate read data sections or can I do it in one?
healyhatman 30 May, 2020
One. In found, do an event switcher where if {var:readfataname.model.radio35} is Y you do the redirect
spytech 30 May, 2020
Thanks, I managed to get that working with what you suggested, cheers.
This topic is locked and no more replies can be posted.