# How to Create a Database User Input Form in 5 Minutes

**URL:** <https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079>\
**Category:** Ignition\
**Created:** [September 18, 2014, 11:56pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079 "2014-09-18T23:56:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 18, 2014, 11:56pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/1 "2014-09-18T23:56:11Z")

</div>

I recently created a component palette that contains pre-configured components for quickly creating database-backed user input forms in Ignition. More information about it can be found here: [nickmudge.info/post/new-componen … n-Ignition](http://nickmudge.info/post/new-components-for-database-backed-user-input-forms-in-Ignition)

I attached the project file that contains the Form Components palette and a Python module that the components use. Import the project file into a project to use the new form components.

I also recorded a video of myself creating a database-backed user input form from scratch in less than five minutes. The video is here: [youtube.com/embed/nh\_ksHFEz … 0&vq=hd720](https://www.youtube.com/embed/nh_ksHFEzm0?rel=0&vq=hd720)

Another video I made shows better information about how the new form components work. It is here: [youtube.com/embed/hZO5YQALk … 0&vq=hd720](https://www.youtube.com/embed/hZO5YQALk9o?rel=0&vq=hd720)  
[FormComponentsPalette.proj](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2f2531b43b72029996a1d68f4ef4ac73412254dc.proj) (36.7 KB)

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [September 19, 2014, 11:38am UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/2 "2014-09-19T11:38:57Z")

</div>

Uh… that is awesome! I am definitely going to check this out. Very nice work, Nick!

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 19, 2014, 12:19pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/3 "2014-09-19T12:19:06Z")

</div>

Nice! Though for me it would be ‘Under 15 Minutes’. You just type faster that I do! 😃

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [September 19, 2014, 1:30pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/4 "2014-09-19T13:30:45Z")

</div>

I changed over an editable table to this in under 20 minutes and I only had to watch the Youtube video once, so that’s a win! I’m very impressed. If you get some extra time it would be nice if you could do a little write up about the python scripting behind it, I don’t fully understand how all of it works. I think this is the first time I’ve seen classes used in an Ignition python script module. I’m not following how those class instances get created and manipulated.

But this is great stuff! I will put this to good use, thanks for sharing and making it available to everyone!

---

<div class="post-metadata">

**Author:** ![Chris\_Taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_taylor/32/3315_2.png) [@Chris\_Taylor](https://forum.inductiveautomation.com/u/Chris_Taylor)\
**Post date:** [September 19, 2014, 1:59pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/5 "2014-09-19T13:59:46Z")

</div>

Nick

Very nice, I tried it out today as I have a project that this will be useful with.

I’ll seek you out at the ICC next week and have a chat.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 19, 2014, 3:37pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/6 "2014-09-19T15:37:37Z")

</div>

Great guys.

Duffanator, here’s to answer your question about classes in the project.pa.forms Python module:  
The FormInput class is defined and used as a way to treat all form input components the same way.

A new instance of a FormInput class is created by passing in a form input component argument to the constructor, like this: formInputInstance = FormInput(formInputComponent). A FormInput instance provides a common set of methods to access data and functionality for any form input component.

New instances of the FormInput class are created in one place, in the getInputs function, which is here:

```auto
def getInputs(formContainer):
	"""
	Get all form input components in a Form Container.
	"""
	inputs = []
	for comp in formContainer.getComponents():
		if isinstance(comp,BasicContainer):
			if not hasattr(comp,"Column"):
				inputs.extend(getInputs(comp))
				continue
			inputs.append(FormInput(comp))
	return inputs
```

Notice this line: “inputs.append(FormInput(comp))”. This is creating a new FormInput instance from a form input component and appending it to the list of other FormInput instances.

The form input components are the form components that have a “Column” custom property. Some of these are the “Form Text Field”, “Form Numeric Text Field”, “Form Dropdown List” and “Form Radio Buttons”.

The getInputs function finds each input form component, creates a FormInput instance with it and adds it to a list. When all the input form components are found the list of FormInput instances are returned.

Here’s a couple examples to show you how this is used. Normally to get the value from a Form Text Field component you have to use this code:

```auto
value = formTextField.getComponent("Text Field").text
```

And if you want to get a value from the Form Dropdown List component you have to use this code:

```auto
dropdownList = formDropdownList.getComponent("Dropdown List")
value = getattr(dropdownList,dropdownList.ValueProperty)
```

But if you create FormInput instances of these two form input components then accessing the value is done in the same way:

```auto
formTextField = FormInput(formTextField)
formDropdownList = FormInput(formDropdownList)

value = formTextField.getValue()
value = formDropdownList.getValue()
```

Besides getValue() the FormInput class provides other uniform functions for form input components such as setValue(), clearValue(), and more can be added as needed in the future.

So the getInputs() function returns a list of all form input componets as FormInput instances. This makes it easy to loop through all form inputs and perform an operation on all of them. For example:

```auto
inputs = getInputs(formContainer)
for input in inputs:
	print input.getValue()
```

How is this? Any other questions?

Best,

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 19, 2014, 3:46pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/7 "2014-09-19T15:46:17Z")

</div>

Chris Taylor, I look forward to meeting you at the conference.

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [September 21, 2014, 3:53pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/8 "2014-09-21T15:53:04Z")

</div>

Very Nice.

---

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [October 15, 2014, 7:53am UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/9 "2014-10-15T07:53:37Z")

</div>

Perfect… Thanks a lot . ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:") ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:") ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:") ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [October 25, 2014, 4:00pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/10 "2014-10-25T16:00:23Z")

</div>

The addition of a dropdown calendar form component for selecting datetimes would be nice.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [December 23, 2014, 12:10am UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/11 "2014-12-23T00:10:51Z")

</div>

[quote=“Duffanator”]The addition of a dropdown calendar form component for selecting datetimes would be nice.[/quote]Yes, indeed. Today I released exactly that: a new Form Popup Calendar component and a new Form Check Box component. See the blog post here: [nickmudge.info/post/new-form-pop … components](http://nickmudge.info/post/new-form-popup-calendar-and-form-check-box-components)

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [December 24, 2014, 3:18pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/12 "2014-12-24T15:18:12Z")

</div>

Ahhh, perfect! I actually made my own drop down calendar component but yours works better. The check box is also a nice addition. Thanks Nick!

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [March 31, 2015, 12:52pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/13 "2015-03-31T12:52:25Z")

</div>

whats the best way to have the form component access two different tables, ie… Insert into one and read from another, would just nested form containers work?

---

<div class="post-metadata">

**Author:** ![Clkman](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@Clkman](https://forum.inductiveautomation.com/u/Clkman)\
**Post date:** [August 21, 2015, 1:10pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/14 "2015-08-21T13:10:24Z")

</div>

Hi Nick,

I’m using 7.6.4 and I was wondering if there would be any problems using your form pallet?

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [August 21, 2015, 3:03pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/15 "2015-08-21T15:03:42Z")

</div>

Hi Clkman,

Because the project file was created using Ignition 7.7.2 it can only be imported into an Ignition server that is 7.7.2 or above. Sorry about that.

Best,

---

<div class="post-metadata">

**Author:** ![KA4HRE](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ka4hre/32/42145_2.png) [@KA4HRE](https://forum.inductiveautomation.com/u/KA4HRE)\
**Post date:** [December 15, 2017, 4:38pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/16 "2017-12-15T16:38:08Z")

</div>

Watch the video - this will save me MANY hours of work…  
Alas, the link to the PROJ does not work.  
Hopefully it can be fixed and I can start using this!

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [December 15, 2017, 9:33pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/17 "2017-12-15T21:33:29Z")

</div>

The .proj link in the OP didn’t work for me, however, going through to Nick’s website (1st link) and downloading it there did work.

---

<div class="post-metadata">

**Author:** ![jcoleman](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jcoleman](https://forum.inductiveautomation.com/u/jcoleman)\
**Post date:** [September 28, 2018, 3:19pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/18 "2018-09-28T15:19:01Z")

</div>

Has anyone seen any issues with this under 7.9.8/9?

---

<div class="post-metadata">

**Author:** ![Brian](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@Brian](https://forum.inductiveautomation.com/u/Brian)\
**Post date:** [September 28, 2018, 4:19pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/19 "2018-09-28T16:19:59Z")

</div>

You will probably have to enable the legacy database access permissions for the project. Ignition introduced named queries a few versions ago and the legacy db access permissions are turned off by default for new projects.

---

<div class="post-metadata">

**Author:** ![rbaker](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@rbaker](https://forum.inductiveautomation.com/u/rbaker)\
**Post date:** [September 9, 2019, 5:48pm UTC](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079/20 "2019-09-09T17:48:19Z")

</div>

None of the links seem to be working. Is this project still available?

[Next page](https://forum.inductiveautomation.com/t/how-to-create-a-database-user-input-form-in-5-minutes/9079.md?page=2)
