Layout based form questions (solved)

We have a layout based form that works just fine. It has various inputs that the providers use to save encounter data.

They want on the form a non-editable line of text that contains data pulled from the database about the patient.

I have the sql that will pull the data needed from the database.

What combination of things do I need to do so that I can get that little piece of text into the form?

Anyone stumbling across this post in the future trying to accomplish this same thing. Here is how i was able to do it.

You’ll need to make a lbf plugin.
Your plug in will reside in the sites/default/LBF/ directory
Look at the plugins there to get the idea of what should be in the plugin php file.

Basically the name of the file is formId.plugin.php where formId is the id you gave to the form when you made it. It starts with “LBF”.

This file contains javascript that will be added to the lbv form.
In my instance, i used php code to query the database and and then echo the javascript code so that it had the info from the database. This javascript code changed the innerHTML of a specific div.

In the lbv form, for the field where the data goes, set the option to “Description is the default text”. Then in the description put:

No data found
( i used the static text data type)

So, when the lbv form loads, the php code in the plug in pulls data from the database. Then writes javascript code that changes the innerHTML text of the div you added to the layout.

If anyone knows of an easier way to pull data from the database and put it into the lbv form please let me know. This method is sort of like going around the world to get next door.

1 Like