cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
cjones
Nintex Newbie

How do you validate a single line text box based on a yes/no field?

Jump to solution

I'm having issues requiring a single line text box be filled IF a yes/no checkbox is marked "yes". I have tried multiple validation rules, but to no success. Any help is appreciated.

Reply
9 Replies
emha
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

formula like this should work

CheckBoxControl && IsNullOrEmpty(SingleLineTextBox)

Reply
Chris_Ben
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

Hi Cody, if you are going to make multiple fields mandatory when the checkbox is being used, then I'd take advantage of the {self} named control.  i.e. for any control that this formula is applied to, make it mandatory.  Exactly what Marian has put above but use {self} instead of the SingleLineTextBox name.  Here's an example.

Let's say we have a form where there's a tick box to send an email.  Any field that has an email field then becomes mandatory.  The tick box column/control is called SendEmail.  The text box is called YourEmail.  Here's an image of the formula already set up on that field.

Here's what the formula looks like:

You'll see that I double clicked on the named control {Self} instead of YourEmail.  Here's what it looks like when the user hits save and they haven't entered something in that text field.

Here's the benefit of using {self}.  Let's assume we want them to enter a second email address too and this is also mandatory if the Send Email checkbox is ticked.  We don't need to write a new formula, we'll just apply the one we've already written to the new control and it will work.  No changes required.

Cheers,

Chris

Reply
cjones
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

I'm guessing this is a function that is not available for everyone or something. I've tried your way multiple times and just did again, exactly, and it still does not require the field to be filled. 

0 Kudos
Reply
Chris_Ben
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

No, those runtime functions are available in every version of Nintex Forms.  First things first, is it definitely a yes/no check box or is a choice field?  If it's a choice field your formula would be different something like this:

ChoiceFieldControl=="Yes" && IsNullOrEmpty({self})

Also make sure you've applied the validation formula to the text box control, not to the yes/no box.

Cheers,

Chris

0 Kudos
Reply
cjones
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

Yes, it is a yes/no box. I have applied the validation formula to the single line text box, as well as, its control label. I have done this both separately and together. Still, it does not required the field to filled. I have this field, a long with others, in a panel that is hidden unless the same yes/no box is marked. That function works perfectly. However, no validation rule works. I can "hide" and "disable" those exact fields with formatting rules, but no validation rules will work. What I am going to do is re-create the list to see if it is just a bug. If it still doesn't work then I'm guessing the function is not available. 

0 Kudos
Reply
Chris_Ben
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

Hi Cody, export your form and upload the file here and we'll have a look.  The function definitely exists.  You don't need to apply that validation rule to the label, just the control but applying it to the label won't affect this result.

You also don't need to recreate the list as all functionality is based on the form controls so nothing to do with the list.  While we're on that topic, you're evaluating the checkbox form control right?  Not the item property?

Cheers,

Chris

0 Kudos
Reply
cjones
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

Well I didn't see this in time, but there had to be a bug with the SharePoint list. When I recreated the list and used the same validation rule, it worked. The only issue I'm having now is getting a choice field to also be required, as it seems Nintex is seeing the "Please select a value..." text, as an answer. Also, I'm unable to export/upload the form due to company policy. 

0 Kudos
Reply
Chris_Ben
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

When you originally created the text field, did you create directly from the form or did you create in the list?  You may have had an unamed control.  Regardless, that part is fixed so that's great.

To make the choice field mandatory, do this from SharePoint rather than Nintex Forms.  You can go into the list settings, then edit that field and there will be an option to make it mandatory.

Cheers,

Chris

0 Kudos
Reply
marisar
Nintex Newbie

Re: How do you validate a single line text box based on a yes/no field?

Jump to solution

Thanks!  I've used to validate people picker field has been completed when a Yes/No box is checked.  Works great.

Reply