Can I create custom form with some fields filled in with default value?

simpleone81 wrote on Saturday, November 23, 2013:

Hello,

Does anyone know if there is a way to create custom forms with some fields filled in with default value?

I tried to look at layout-based forms but couldn’t find any option to put in default value for a text field.

thanks.

blankev wrote on Saturday, November 23, 2013:

YES, Find some explanation under WIKI-FAQ

simpleone81 wrote on Saturday, November 23, 2013:

Thanks for your response, Pieter.

Do you meant this wiki? (http://www.open-emr.org/wiki/index.php/FAQ)

I tried looking up there but couldn’t find any information on populating a field with default value.

Would you mind pointing me to the precise link?

thanks!

blankev wrote on Saturday, November 23, 2013:

Start exploring number 23 on that page. Or ask fsgl for specifics.

As an example you can follow the Ophthalmic Forms for non-typists.

fsgl wrote on Saturday, November 23, 2013:

J.H.,

Are you inquiring about Contributed forms that you can use right off the shelf?

Or are you asking about a static text LBV form? If that is the case, CAMOS may be a better choice because static text LBV forms are harder to construct.


Pimm,

I’ve reworked the FAQ page. #23 is now #20.

blankev wrote on Saturday, November 23, 2013:

Hello fsgl,

are you sure you saved your rewriting efforts? Nation Notes is still #23 in the Demo Version Open-EMR.org/wiki…/FAQ

But indeed the you can’t use Nation Notes without understanding Layout Based Visit Forms.

Do you know what file have to be attacked to change the Word: Lay-out Based? For most USERS this is not something inviting to use. I would rather change it in Personal Medical or similar.

simpleone81 wrote on Saturday, November 23, 2013:

fsgl/Pieter,

My initial question (at an entry-user level) is trying to figure out how to create a field in a layout based form that can be populated with default value. I would first edit the list to add a new layout based form. Then I will click layout to add groups and fields of that layout based form. However, during creation of fields in different groups I couldn’t find out an option for me to set a default value.

Anyway, later when I dig into this more, I see there is another way to create custom form and people have been creating some such forms to contribute to the community. However, I actually feel like layout based forms are easier for me to create (without the need to do any programming).

fsgl wrote on Saturday, November 23, 2013:

Hi Pimm,

NationNotes being #23 is part of my editing. No problem there.

The wording “Layout-Based Forms” appears only in Lists. I think the original connotation is that these forms are derived from layouts or arrangements as in newspaper or magazine layouts. The hyphen is between “Layout” and “Based”.

I hope that you don’t think that there are any innuendos implied.

Non-sequitur: All 3 Demo’s are offline today. Won’t it be great if Brady found time to upgrade the PHP’s for the Demo’s? Then you will be granted your wish to import to your heart’s content. Let hope it’s that and not their collective demise.


J.H.,

It is unclear what you mean by “default value”. Try to reword the concept or express what is it that you trying to accomplish without using “default value”.

By definition, each cell will be assigned a value chosen by the user. If there are pre-determined or fixed values to a form, it is one that is already built, as in Demographics. There are no “default” entries assigned to a new form that a user wishes to create.

Pimm and I will be happy to assist you in the creation of your new LBV forms but we cannot help if we don’t know what it is that you are trying to do.

simpleone81 wrote on Sunday, November 24, 2013:

Thanks fsgl.

Let me simplify my question - if I want to create a “text field” or “text area field” in a layout. Is there any option for me to pre-fill that text field or text area field with some free text default value like “abcdefd”?

thanks!

simpleone81 wrote on Sunday, November 24, 2013:

The other simple and kind of related question is - if I have 5 text fields in a group, how can I arrange them into 5 rows? I tried to put in order 1, 2, 3, 4, 5 for these 5 fields but each row actually end up having two fields. So at the end I got 3 rows but I really want to have 5 rows? Is there any control for me to arrange text fields / checklist fields into separate rows or multiple rows?

thanks.

openemrdev wrote on Sunday, November 24, 2013:

Hi J.H.

If you want to create a default values on LBF forms.you can load static default values on javascript onload functions - Check example for this functions on /openemr/sites/default/LBF/xxx.plungin.php.

This examples is only for onload functions,not for default values

If you want create default values on custom forms,you could set your default values on html elements,like

If you want random default values in form,you need to do more customizations.

Please let me know

openemrdev@gmail.com

sunsetsystems wrote on Sunday, November 24, 2013:

Current development code includes a “T” option which makes the Description field a default value for the data. This works well for textareas and seems to be exactly what you asked for.

However it’s not in 4.1.2. Here’s the commit, if you want to try putting it in yourself:

Rod
http://www.sunsetsystems.com/

simpleone81 wrote on Sunday, November 24, 2013:

Thanks. I was hoping to use existing lay-out based form settings to setup a note template but I found that’s not very easy. Especially in the lack of formatting. It doesn’t give the flexibility as a WYSIWYG editor.

On the other hand, if I create a nation note then I couldn’t figure out how to preload contents and checklists.

Custom form in the “Contributed” folder seems to be pretty flexible but it appears to require programming and also creating new tables? Is there a tutorial on how to create custom form programmatically?

thanks.

simpleone81 wrote on Sunday, November 24, 2013:

Rod - interesting to know. thanks.

blankev wrote on Sunday, November 24, 2013:

Tnx, Rod,

I included your contribution in the FAQ and changed the Wiki Index-page, to make the FAQ-page more visible.

http://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page

http://www.open-emr.org/wiki/index.php/LBV_Forms

Please check the changes I made, and please make corrections if needed!

fsgl wrote on Sunday, November 24, 2013:

J.H.,

The easiest way to have a static text form is to use CAMOS (see link above). The Wiki article is clearly written and easy to understand. With CAMOS there is little customization involved. You probably want to change Categories and Subcategories to suit the practice. The other nice feature is the search engine. If you have a big collection of static text notes, search will come in handy to locate a particular form in a hurry.

To deploy the T option, use Rod’s link. Download Notepad++. In interface/super/ edit_layout.php, delete the old line 487 and insert the new line 487. In library/ options.inc.php, delete the old line 2 and the space and insert the new line 2, line 29 and 121 through 129. Basically you will be deleting the lines in pink and inserting the lines in mint green.

Static text LBV forms can be constructed without the T option, but this exercise involves much more work than using CAMOS right out of the box.

It is less efficient to use NationNotes because there is little point in clicking and inserting Components and then typing in phrases to connect the Components.

If you are bound and determined to construct a static text LBV form without using the T option, we will help you.

See this thread, if don’t wish to change the codes.

To squeeze more than 2 fields in: start off by using 1, 1 for the left most field on a particular line and use 0, 0 for subsequent fields in this line. To fit all fields into the perimeter of the form, the composite size of the fields must be adjusted. To achieve symmetry, trial and error is required.

Try both CAMOS and static text LBV form, minus the T option, on the Demo’s. This way you get a good feel for both before implementation in your local machine.

fsgl wrote on Sunday, November 24, 2013:

Hi Pimm,

Rod’s code change involves 2 PHP files.

I have taken the liberty of editing your Wiki article so that the reader won’t think it’s just the layout editor file that requires modification.

The Demo’s didn’t die, but no PHP upgrades either.

simpleone81 wrote on Sunday, November 24, 2013:

Thanks fsgl for the very detailed response! I tried CAMOS option and my feeling is that it is similar to NationaNote but what I really want is when I pick a note type, it will populate most of the contents with options as check boxes. This will save the end user from typing. CAMOS is not very intuitive in the way that you have to pick category and sub-category etc…

simpleone81 wrote on Sunday, November 24, 2013:

I am continuing to explore LBF. One thing I found is that even though I follow the trick to add a static text field to produce an “empty line” when we initiate the form to be filled in, after I fill in everything and save the note, the “empty line” won’t be saved and thus I lose the format. Is there a way to add a true “empty line” in LBF to be persisted so later when we look at the note it will still be there (and preserved to be in the generated reported to be printed out)?

Similarly, is there a way in LBF to start a new line from a few spaces to the right compared to the last line? (indent)

I know I am probably asking for some features in a WYSIWYG editor which may not be the design purpose of LBF but I really want to see how much potential I can get out from LBF.

thanks!

blankev wrote on Sunday, November 24, 2013:

Going from memory:

make a label for a text field with a name/description => Save => than edit same line and delete the name/description but don’t delete anything from the rest of that line.

Same would go with indent. Make an empty field as explained just before. Than follow this “empty field” with the fields you want to be included but indented. Have to repeat the empty field in every line of the Form-indented part.

Please let us know your discoveries on the run, so the corrected information can be in the Wiki-pages.