A field to be … filled by itself !!!
3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 2, 2016 (RSS)
By andreasml - May 1, 2016
I want to make a text field to be filled by itself.
In particular, I am trying to construct a database of patients who receive a type of treatment which is allocated randomly between two or more options (usually there are only two options).
My initial plan was to create a section with the various options of treatment. Then, on the main section that contains all the patients details, i would insert a list field which will pick the specific type of treatment.
Nevertheless, there are two issues that i cannot solve:
1. The treatment should be picked randomly among the various options.
2. The user would not be able to change the initial random choice of treatment. Thus, the patient would be listed according to the treatment option which had been picked on a random way. Of course, the administrator must be able to change this.
Any ideas / suggestions / advice would be more than helpful. My level regarding programming is fundamental (basic knowledge of HTML and some knowledge regarding databases).
By Damon - May 2, 2016
Hi,
So it sounds like you want the user to log into CMS Builder, create a patient record and have a list field show one random treatment option to choose that is from a list of treatments. Then, after the user saves the record, with the random selected treatment, they can no longer change the random selected treatment (only an admin can).
Here is what is needed:
1. a MySQL query to return a single random result from a treatment list that already exists in the database. The treatment list can be created using a section editor for "Treatments" and adding the available treatment options.
2. to protect the treatment field from later being edited by a user, it needs to be set as Admin access only. This prevents the user from seeing and entering a treatment option though. The solution is to have a custom plugin written that will automatically save the random treatment selection when the record. The code could be added to the page so the user could see the treatment option selected for that patient but not be able to edit it.
When creating a new patient record, a user will also not be able to refresh the browser multiple times to get another randomly created treatment option.
How does this sound? The next step is to email Ross at consulting@interactivetools.com and confirm the details and he will be able put together a quote for you.
Please let me know if you have any questions.
Thanks!
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By andreasml - May 2, 2016
Hi Damon
I think that this is exactly what is needed! Besides the plugin, i think that i will also need the MySQL query so as to be sure that everything is working properly.
Kind regards
Andreas