# Required information

**URL:** <https://forum.inductiveautomation.com/t/required-information/35720>\
**Category:** Ignition\
**Created:** [June 16, 2020, 5:07pm UTC](https://forum.inductiveautomation.com/t/required-information/35720 "2020-06-16T17:07:11Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [June 16, 2020, 5:07pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/1 "2020-06-16T17:07:11Z")

</div>

I have a window that has multiple text boxes on it. My users are entering information into those boxes or in some cases just selecting a toggle box. After that they click on a submit button to dump the information into a sql table I have created.

How can I make that submit button require all the other boxes to have information and/or be actually selected if they are a toggle button before the submit button will actually fire and dump the information?

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [June 16, 2020, 5:37pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/2 "2020-06-16T17:37:53Z")

</div>

Add expression binding to the Enable property of the submit button. For example, if you want text in a text box, the expression might be len({Root Container.Text Box.text}) \> 0.  
You can join multiple conditions together with logical operator (&&, ||, etc.).

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [June 16, 2020, 5:47pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/3 "2020-06-16T17:47:34Z")

</div>

So what if it is a string tag or int. tag instead?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [June 16, 2020, 6:20pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/4 "2020-06-16T18:20:09Z")

</div>

```java
// Require either an entry in text box or integer entry field.
len({Root Container.Text Box.text}) > 0
|| {Root Container.IntEntry.value} > 0
// Add more conditions with and (&&) or or (||), grouping with parenthesis as needed.

```

Or if you mean a tag value, not a value from a component as shown above, your expression would use the tags, something like:

```java
len({[default]stringTag}) > 0
|| {[default]intTag} > 0

```

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [June 16, 2020, 6:45pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/5 "2020-06-16T18:45:02Z")

</div>

I got the coding to work:

len({Root Container.AreaSelected.text}) \> 0  
&& ({Root Container.ShiftSelected.text}) \> 0

but this does nto require both of them to be \> 0. Right now when I select the shiftselected text box and enter info the submit button becomes visible, but not when I select the AreaSelected text box.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [June 16, 2020, 6:46pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/6 "2020-06-16T18:46:15Z")

</div>

Try (note second `len`):

```auto
len({Root Container.AreaSelected.text}) > 0
&& len({Root Container.ShiftSelected.text}) > 0

```

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [June 16, 2020, 6:48pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/7 "2020-06-16T18:48:39Z")

</div>

Nope… that just makes the submit button back to displaying all the time… LOL

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [June 16, 2020, 7:02pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/8 "2020-06-16T19:02:36Z")

</div>

I actually tried the text box and the tag options and they both had the same outcomes… weird…

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [June 16, 2020, 7:08pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/9 "2020-06-16T19:08:11Z")

</div>

Works for me on 8.0.12:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6437bc906520181935f96b1b36b92689362c9d55.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/3a8f7f6c0dc88a30547aee230d5e1bc46d7debf8.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8dcc736dce6c06a9d32b8f5377470141eb8ec197.png)  
Code in enabled property of button (as you posted above):  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/9a2f1431f393a46d2ffa6019e398c26044909b67.png)

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [June 16, 2020, 7:13pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/10 "2020-06-16T19:13:27Z")

</div>

Hmmmm. I dont know. I have exactly what you have and it does not work. I am using version 7.9.13.

Oh well. I guess I try to figure something else out.

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [June 16, 2020, 7:13pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/11 "2020-06-16T19:13:49Z")

</div>

Thank you for all your help!! I sincerely appreciate you taking the time…

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [June 16, 2020, 7:15pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/12 "2020-06-16T19:15:47Z")

</div>

Something else that is weird is that even if I uncheck the check box in the enable property I can actually still click on the submit button and it fire…

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [June 16, 2020, 7:24pm UTC](https://forum.inductiveautomation.com/t/required-information/35720/13 "2020-06-16T19:24:47Z")

</div>

That is weird. If you’re doing all this in the Designer, maybe try restarting it. I also just verified the button in my example definitely won’t run the code I put in it when it is disabled. There is another issue with this method; the button doesn’t get enabled/disabled unless enter is pressed or mouse clicks elsewhere after entering/removing text in a field. This could be resolved by scripting focus on something else on mouse exit of the text fields.

A different method–and the one I’d generally use–would be to check for required values in the script that executes when you tap the button instead of disabling the button. If required values aren’t there, notify the user that they need to enter them. This would all be in the button’s actionPerformed event handler.

```python
areaEntered = len(event.source.parent.getComponent('AreaSelected').text) > 0
shiftEntered = len(event.source.parent.getComponent('ShiftSelected').text) > 0
if areaEntered and shiftEntered:
	# Do something.
	pass
else:
	# Notify user.
	pass

```

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 17, 2020, 1:53am UTC](https://forum.inductiveautomation.com/t/required-information/35720/14 "2020-06-17T01:53:50Z")

</div>

Here is my 2c.  
You should create a custom property on each of the input components called something like ‘isValid’. Let each component decide what is valid and then combine these properties in a binding on your Submit button’s Enabled property.  
There are numerous benefits to adding the properties onto the inputs rather than just validating them in the Submit button’s bindings.  
The biggest benefit is that you can use the isValid property to affect the styling of the component, e.g. highlighting it with a colour if it’s invalid.
