# Prevent blank text input and ensure that a selection was made

**URL:** <https://forum.getodk.org/t/prevent-blank-text-input-and-ensure-that-a-selection-was-made/3634>\
**Category:** Support\
**Created:** [September 16, 2014, 11:55am UTC](https://forum.getodk.org/t/prevent-blank-text-input-and-ensure-that-a-selection-was-made/3634 "2014-09-16T11:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Watterusername](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/w/c5a1d2/32.png) [@Watterusername](https://forum.getodk.org/u/Watterusername)\
**Post date:** [September 16, 2014, 11:55am UTC](https://forum.getodk.org/t/prevent-blank-text-input-and-ensure-that-a-selection-was-made/3634/1 "2014-09-16T11:55:22Z")

</div>

I am using XLSform, and the first form was good, but now I was requested to add a much longet list of items.  
I am now using groupings for selection entries.

I am struggling to ensure that a group with two selections can't be skipped. I want an error that say something in the line of "Select an Option under Drivers" in stead of the standard "Sorry that response is required." when required is set to "yes". I want to skip a question if the data is not available so it can be edited later.

The other problem is ensuring that there is no blank in a text field.  
The constraint I use with a text field is .!= ''  
But it simply ignores if the input is blank.

How can I change this behaviour or do I need to hand edit the XML?

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [September 16, 2014, 4:24pm UTC](https://forum.getodk.org/t/prevent-blank-text-input-and-ensure-that-a-selection-was-made/3634/2 "2014-09-16T16:24:44Z")

</div>

You need to specify true() under the required column to ensure that the  
user enters something in the text field. An empty string is treated the  
same as if no data was entered. By requiring the user to enter data, you  
are requiring that the string/field be non-empty.

You can specify the message to display when a required field is not  
specified just like you can with a constraint fails. Create a  
"required\_message" column and specify the text you want to display when the  
required formula evaluates to true and the user does not enter a value in  
the field.

> **···**
>
> On Tue, Sep 16, 2014 at 4:55 AM, wrote:
> 
> > I am using XLSform, and the first form was good, but now I was requested  
> > to add a much longet list of items.  
> > I am now using groupings for selection entries.
> > 
> > I am struggling to ensure that a group with two selections can't be  
> > skipped. I want an error that say something in the line of "Select an  
> > Option under Drivers" in stead of the standard "Sorry that response is  
> > required." when required is set to "yes". I want to skip a question if the  
> > data is not available so it can be edited later.
> > 
> > The other problem is ensuring that there is no blank in a text field.  
> > The constraint I use with a text field is .!= ''  
> > But it simply ignores if the input is blank.
> > 
> > How can I change this behaviour or do I need to hand edit the XML?
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)
